Remove ParseFieldMatcher usages from QueryRewriteContext

This commit is contained in:
javanna 2017-01-12 11:37:49 +01:00 committed by Luca Cavanna
parent 8072f168a3
commit 4449eb181b

View File

@ -20,8 +20,6 @@ package org.elasticsearch.index.query;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.elasticsearch.client.Client; import org.elasticsearch.client.Client;
import org.elasticsearch.common.ParseFieldMatcher;
import org.elasticsearch.common.ParseFieldMatcherSupplier;
import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.xcontent.NamedXContentRegistry; import org.elasticsearch.common.xcontent.NamedXContentRegistry;
import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentParser;
@ -37,7 +35,7 @@ import java.util.function.LongSupplier;
/** /**
* Context object used to rewrite {@link QueryBuilder} instances into simplified version. * Context object used to rewrite {@link QueryBuilder} instances into simplified version.
*/ */
public class QueryRewriteContext implements ParseFieldMatcherSupplier { public class QueryRewriteContext {
protected final MapperService mapperService; protected final MapperService mapperService;
protected final ScriptService scriptService; protected final ScriptService scriptService;
protected final IndexSettings indexSettings; protected final IndexSettings indexSettings;
@ -87,11 +85,6 @@ public class QueryRewriteContext implements ParseFieldMatcherSupplier {
return reader; return reader;
} }
@Override
public ParseFieldMatcher getParseFieldMatcher() {
return this.indexSettings.getParseFieldMatcher();
}
/** /**
* The registry used to build new {@link XContentParser}s. Contains registered named parsers needed to parse the query. * The registry used to build new {@link XContentParser}s. Contains registered named parsers needed to parse the query.
*/ */
@ -100,8 +93,7 @@ public class QueryRewriteContext implements ParseFieldMatcherSupplier {
} }
/** /**
* Returns a new {@link QueryParseContext} that wraps the provided parser, using the ParseFieldMatcher settings that * Returns a new {@link QueryParseContext} that wraps the provided parser.
* are configured in the index settings. The default script language will always default to Painless.
*/ */
public QueryParseContext newParseContext(XContentParser parser) { public QueryParseContext newParseContext(XContentParser parser) {
return new QueryParseContext(parser); return new QueryParseContext(parser);
@ -115,6 +107,4 @@ public class QueryRewriteContext implements ParseFieldMatcherSupplier {
ExecutableScript executable = scriptService.executable(template, ScriptContext.Standard.SEARCH); ExecutableScript executable = scriptService.executable(template, ScriptContext.Standard.SEARCH);
return (BytesReference) executable.run(); return (BytesReference) executable.run();
} }
} }