Make indexQueryParserService available. Closes #8248

This commit is contained in:
Uwe Schindler 2014-10-28 12:30:36 +01:00
parent f9b5906871
commit 1d95630a35
4 changed files with 8 additions and 4 deletions

View File

@ -82,7 +82,7 @@ public class QueryParseContext {
private boolean requireCustomQueryWrappingFilter = false; private boolean requireCustomQueryWrappingFilter = false;
final IndexQueryParserService indexQueryParser; private final IndexQueryParserService indexQueryParser;
private final Map<String, Filter> namedFilters = Maps.newHashMap(); private final Map<String, Filter> namedFilters = Maps.newHashMap();
@ -137,6 +137,10 @@ public class QueryParseContext {
return parser; return parser;
} }
public IndexQueryParserService indexQueryParserService() {
return indexQueryParser;
}
public AnalysisService analysisService() { public AnalysisService analysisService() {
return indexQueryParser.analysisService; return indexQueryParser.analysisService;
} }

View File

@ -83,7 +83,7 @@ public class TemplateQueryParser implements QueryParser {
BytesReference querySource = (BytesReference) executable.run(); BytesReference querySource = (BytesReference) executable.run();
try (XContentParser qSourceParser = XContentFactory.xContent(querySource).createParser(querySource)) { try (XContentParser qSourceParser = XContentFactory.xContent(querySource).createParser(querySource)) {
final QueryParseContext context = new QueryParseContext(parseContext.index(), parseContext.indexQueryParser); final QueryParseContext context = new QueryParseContext(parseContext.index(), parseContext.indexQueryParserService());
context.reset(qSourceParser); context.reset(qSourceParser);
Query result = context.parseInnerQuery(); Query result = context.parseInnerQuery();
return result; return result;

View File

@ -58,7 +58,7 @@ public class WrapperFilterParser implements FilterParser {
byte[] querySource = parser.binaryValue(); byte[] querySource = parser.binaryValue();
try (XContentParser qSourceParser = XContentFactory.xContent(querySource).createParser(querySource)) { try (XContentParser qSourceParser = XContentFactory.xContent(querySource).createParser(querySource)) {
final QueryParseContext context = new QueryParseContext(parseContext.index(), parseContext.indexQueryParser); final QueryParseContext context = new QueryParseContext(parseContext.index(), parseContext.indexQueryParserService());
context.reset(qSourceParser); context.reset(qSourceParser);
Filter result = context.parseInnerFilter(); Filter result = context.parseInnerFilter();
parser.nextToken(); parser.nextToken();

View File

@ -58,7 +58,7 @@ public class WrapperQueryParser implements QueryParser {
byte[] querySource = parser.binaryValue(); byte[] querySource = parser.binaryValue();
try (XContentParser qSourceParser = XContentFactory.xContent(querySource).createParser(querySource)) { try (XContentParser qSourceParser = XContentFactory.xContent(querySource).createParser(querySource)) {
final QueryParseContext context = new QueryParseContext(parseContext.index(), parseContext.indexQueryParser); final QueryParseContext context = new QueryParseContext(parseContext.index(), parseContext.indexQueryParserService());
context.reset(qSourceParser); context.reset(qSourceParser);
Query result = context.parseInnerQuery(); Query result = context.parseInnerQuery();
parser.nextToken(); parser.nextToken();