From bc22c86d14f70e14f248052c72a6ba3e1528fd81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20B=C3=BCscher?= Date: Tue, 20 Dec 2016 11:50:14 +0100 Subject: [PATCH] SuggestionBuilder doesn't need to extend ToXContentToBytes This changes the class from extending the abstract class to implementing the ToXContent interface only. The former could lead to unexpected behaviour when trying to display the object, since the "toString()" method inherited from ToXContentToBytes would create an error message because the SuggestionBuilders toXContent() methods don't render complete json objects. --- .../org/elasticsearch/search/suggest/SuggestionBuilder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/search/suggest/SuggestionBuilder.java b/core/src/main/java/org/elasticsearch/search/suggest/SuggestionBuilder.java index ca1d7a2306f..0028767c36f 100644 --- a/core/src/main/java/org/elasticsearch/search/suggest/SuggestionBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/suggest/SuggestionBuilder.java @@ -21,7 +21,6 @@ package org.elasticsearch.search.suggest; import org.apache.lucene.analysis.Analyzer; import org.elasticsearch.ElasticsearchParseException; -import org.elasticsearch.action.support.ToXContentToBytes; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.ParseFieldMatcher; import org.elasticsearch.common.ParsingException; @@ -29,6 +28,7 @@ import org.elasticsearch.common.io.stream.NamedWriteable; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.lucene.BytesRefs; +import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.index.mapper.MappedFieldType; @@ -43,7 +43,7 @@ import java.util.Objects; /** * Base class for the different suggestion implementations. */ -public abstract class SuggestionBuilder> extends ToXContentToBytes implements NamedWriteable { +public abstract class SuggestionBuilder> implements NamedWriteable, ToXContent { protected final String field; protected String text;