diff options
Diffstat (limited to 'core/src/main/java/org/elasticsearch/search/suggest/completion/context/ContextMapping.java')
-rw-r--r-- | core/src/main/java/org/elasticsearch/search/suggest/completion/context/ContextMapping.java | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/core/src/main/java/org/elasticsearch/search/suggest/completion/context/ContextMapping.java b/core/src/main/java/org/elasticsearch/search/suggest/completion/context/ContextMapping.java index 273138bbb7..697394f3ef 100644 --- a/core/src/main/java/org/elasticsearch/search/suggest/completion/context/ContextMapping.java +++ b/core/src/main/java/org/elasticsearch/search/suggest/completion/context/ContextMapping.java @@ -27,7 +27,6 @@ import org.elasticsearch.common.xcontent.XContentParser.Token; import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.index.mapper.CompletionFieldMapper; import org.elasticsearch.index.mapper.ParseContext; -import org.elasticsearch.index.query.QueryParseContext; import java.io.IOException; import java.util.ArrayList; @@ -100,23 +99,22 @@ public abstract class ContextMapping<T extends ToXContent> implements ToXContent /** * Prototype for the query context */ - protected abstract T fromXContent(QueryParseContext context) throws IOException; + protected abstract T fromXContent(XContentParser context) throws IOException; /** * Parses query contexts for this mapper */ - public final List<InternalQueryContext> parseQueryContext(QueryParseContext context) throws IOException, ElasticsearchParseException { + public final List<InternalQueryContext> parseQueryContext(XContentParser parser) throws IOException, ElasticsearchParseException { List<T> queryContexts = new ArrayList<>(); - XContentParser parser = context.parser(); Token token = parser.nextToken(); if (token == Token.START_ARRAY) { while (parser.nextToken() != Token.END_ARRAY) { - queryContexts.add(fromXContent(context)); + queryContexts.add(fromXContent(parser)); } } else { - queryContexts.add(fromXContent(context)); + queryContexts.add(fromXContent(parser)); } - + return toInternalQueryContexts(queryContexts); } |