From 975fee402a831f12eb684d1535800ed2e20fcf5a Mon Sep 17 00:00:00 2001 From: javanna Date: Wed, 4 Jan 2017 15:57:49 +0100 Subject: [PATCH] remove ParseFieldMatcher usages from suggesters --- .../suggest/completion/context/CategoryQueryContext.java | 6 ++---- .../search/suggest/phrase/LinearInterpolation.java | 2 -- .../search/suggest/phrase/PhraseSuggestionBuilder.java | 2 -- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/search/suggest/completion/context/CategoryQueryContext.java b/core/src/main/java/org/elasticsearch/search/suggest/completion/context/CategoryQueryContext.java index a17b7a87b43..59f59075bd3 100644 --- a/core/src/main/java/org/elasticsearch/search/suggest/completion/context/CategoryQueryContext.java +++ b/core/src/main/java/org/elasticsearch/search/suggest/completion/context/CategoryQueryContext.java @@ -21,8 +21,6 @@ package org.elasticsearch.search.suggest.completion.context; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.ParseField; -import org.elasticsearch.common.ParseFieldMatcher; -import org.elasticsearch.common.ParseFieldMatcherSupplier; import org.elasticsearch.common.xcontent.ObjectParser; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -98,7 +96,7 @@ public final class CategoryQueryContext implements ToXContent { return result; } - private static ObjectParser CATEGORY_PARSER = new ObjectParser<>(NAME, null); + private static ObjectParser CATEGORY_PARSER = new ObjectParser<>(NAME, null); static { CATEGORY_PARSER.declareString(Builder::setCategory, new ParseField(CONTEXT_VALUE)); CATEGORY_PARSER.declareInt(Builder::setBoost, new ParseField(CONTEXT_BOOST)); @@ -110,7 +108,7 @@ public final class CategoryQueryContext implements ToXContent { XContentParser.Token token = parser.currentToken(); Builder builder = builder(); if (token == XContentParser.Token.START_OBJECT) { - CATEGORY_PARSER.parse(parser, builder, () -> ParseFieldMatcher.STRICT); + CATEGORY_PARSER.parse(parser, builder, null); } else if (token == XContentParser.Token.VALUE_STRING) { builder.setCategory(parser.text()); } else { diff --git a/core/src/main/java/org/elasticsearch/search/suggest/phrase/LinearInterpolation.java b/core/src/main/java/org/elasticsearch/search/suggest/phrase/LinearInterpolation.java index e76868b5b3f..dbd1540b325 100644 --- a/core/src/main/java/org/elasticsearch/search/suggest/phrase/LinearInterpolation.java +++ b/core/src/main/java/org/elasticsearch/search/suggest/phrase/LinearInterpolation.java @@ -23,7 +23,6 @@ import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.Terms; import org.apache.lucene.util.BytesRef; import org.elasticsearch.common.ParseField; -import org.elasticsearch.common.ParseFieldMatcher; import org.elasticsearch.common.ParsingException; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; @@ -138,7 +137,6 @@ public final class LinearInterpolation extends SmoothingModel { double trigramLambda = 0.0; double bigramLambda = 0.0; double unigramLambda = 0.0; - ParseFieldMatcher matcher = parseContext.getParseFieldMatcher(); while ((token = parser.nextToken()) != Token.END_OBJECT) { if (token == XContentParser.Token.FIELD_NAME) { fieldName = parser.currentName(); diff --git a/core/src/main/java/org/elasticsearch/search/suggest/phrase/PhraseSuggestionBuilder.java b/core/src/main/java/org/elasticsearch/search/suggest/phrase/PhraseSuggestionBuilder.java index 12d2af289a9..7611d30263c 100644 --- a/core/src/main/java/org/elasticsearch/search/suggest/phrase/PhraseSuggestionBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/suggest/phrase/PhraseSuggestionBuilder.java @@ -22,7 +22,6 @@ package org.elasticsearch.search.suggest.phrase; import org.apache.lucene.analysis.Analyzer; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.ParseField; -import org.elasticsearch.common.ParseFieldMatcher; import org.elasticsearch.common.ParsingException; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; @@ -491,7 +490,6 @@ public class PhraseSuggestionBuilder extends SuggestionBuilder