remove ParseFieldMatcher usages from suggesters

This commit is contained in:
javanna 2017-01-04 15:57:49 +01:00 committed by Luca Cavanna
parent 13dcb8ccbe
commit 975fee402a
3 changed files with 2 additions and 8 deletions

View File

@ -21,8 +21,6 @@ package org.elasticsearch.search.suggest.completion.context;
import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.ParseField; 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.ObjectParser;
import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
@ -98,7 +96,7 @@ public final class CategoryQueryContext implements ToXContent {
return result; return result;
} }
private static ObjectParser<Builder, ParseFieldMatcherSupplier> CATEGORY_PARSER = new ObjectParser<>(NAME, null); private static ObjectParser<Builder, Void> CATEGORY_PARSER = new ObjectParser<>(NAME, null);
static { static {
CATEGORY_PARSER.declareString(Builder::setCategory, new ParseField(CONTEXT_VALUE)); CATEGORY_PARSER.declareString(Builder::setCategory, new ParseField(CONTEXT_VALUE));
CATEGORY_PARSER.declareInt(Builder::setBoost, new ParseField(CONTEXT_BOOST)); CATEGORY_PARSER.declareInt(Builder::setBoost, new ParseField(CONTEXT_BOOST));
@ -110,7 +108,7 @@ public final class CategoryQueryContext implements ToXContent {
XContentParser.Token token = parser.currentToken(); XContentParser.Token token = parser.currentToken();
Builder builder = builder(); Builder builder = builder();
if (token == XContentParser.Token.START_OBJECT) { 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) { } else if (token == XContentParser.Token.VALUE_STRING) {
builder.setCategory(parser.text()); builder.setCategory(parser.text());
} else { } else {

View File

@ -23,7 +23,6 @@ import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Terms; import org.apache.lucene.index.Terms;
import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRef;
import org.elasticsearch.common.ParseField; import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.ParseFieldMatcher;
import org.elasticsearch.common.ParsingException; import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
@ -138,7 +137,6 @@ public final class LinearInterpolation extends SmoothingModel {
double trigramLambda = 0.0; double trigramLambda = 0.0;
double bigramLambda = 0.0; double bigramLambda = 0.0;
double unigramLambda = 0.0; double unigramLambda = 0.0;
ParseFieldMatcher matcher = parseContext.getParseFieldMatcher();
while ((token = parser.nextToken()) != Token.END_OBJECT) { while ((token = parser.nextToken()) != Token.END_OBJECT) {
if (token == XContentParser.Token.FIELD_NAME) { if (token == XContentParser.Token.FIELD_NAME) {
fieldName = parser.currentName(); fieldName = parser.currentName();

View File

@ -22,7 +22,6 @@ package org.elasticsearch.search.suggest.phrase;
import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.Analyzer;
import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.ParseField; import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.ParseFieldMatcher;
import org.elasticsearch.common.ParsingException; import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
@ -491,7 +490,6 @@ public class PhraseSuggestionBuilder extends SuggestionBuilder<PhraseSuggestionB
static PhraseSuggestionBuilder innerFromXContent(QueryParseContext parseContext) throws IOException { static PhraseSuggestionBuilder innerFromXContent(QueryParseContext parseContext) throws IOException {
XContentParser parser = parseContext.parser(); XContentParser parser = parseContext.parser();
PhraseSuggestionBuilder tmpSuggestion = new PhraseSuggestionBuilder("_na_"); PhraseSuggestionBuilder tmpSuggestion = new PhraseSuggestionBuilder("_na_");
ParseFieldMatcher parseFieldMatcher = parseContext.getParseFieldMatcher();
XContentParser.Token token; XContentParser.Token token;
String currentFieldName = null; String currentFieldName = null;
String fieldname = null; String fieldname = null;