From 1d95630a35e8363a8ef5756aaf4b60d5a39fa0ef Mon Sep 17 00:00:00 2001 From: Uwe Schindler Date: Tue, 28 Oct 2014 12:30:36 +0100 Subject: [PATCH] Make indexQueryParserService available. Closes #8248 --- .../org/elasticsearch/index/query/QueryParseContext.java | 6 +++++- .../org/elasticsearch/index/query/TemplateQueryParser.java | 2 +- .../org/elasticsearch/index/query/WrapperFilterParser.java | 2 +- .../org/elasticsearch/index/query/WrapperQueryParser.java | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/elasticsearch/index/query/QueryParseContext.java b/src/main/java/org/elasticsearch/index/query/QueryParseContext.java index 9add4221e26..e7076cbce22 100644 --- a/src/main/java/org/elasticsearch/index/query/QueryParseContext.java +++ b/src/main/java/org/elasticsearch/index/query/QueryParseContext.java @@ -82,7 +82,7 @@ public class QueryParseContext { private boolean requireCustomQueryWrappingFilter = false; - final IndexQueryParserService indexQueryParser; + private final IndexQueryParserService indexQueryParser; private final Map namedFilters = Maps.newHashMap(); @@ -136,6 +136,10 @@ public class QueryParseContext { public XContentParser parser() { return parser; } + + public IndexQueryParserService indexQueryParserService() { + return indexQueryParser; + } public AnalysisService analysisService() { return indexQueryParser.analysisService; diff --git a/src/main/java/org/elasticsearch/index/query/TemplateQueryParser.java b/src/main/java/org/elasticsearch/index/query/TemplateQueryParser.java index 60f7fec80c9..175473d5a96 100644 --- a/src/main/java/org/elasticsearch/index/query/TemplateQueryParser.java +++ b/src/main/java/org/elasticsearch/index/query/TemplateQueryParser.java @@ -83,7 +83,7 @@ public class TemplateQueryParser implements QueryParser { BytesReference querySource = (BytesReference) executable.run(); 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); Query result = context.parseInnerQuery(); return result; diff --git a/src/main/java/org/elasticsearch/index/query/WrapperFilterParser.java b/src/main/java/org/elasticsearch/index/query/WrapperFilterParser.java index 362b039aeb3..eb4399b86a5 100644 --- a/src/main/java/org/elasticsearch/index/query/WrapperFilterParser.java +++ b/src/main/java/org/elasticsearch/index/query/WrapperFilterParser.java @@ -58,7 +58,7 @@ public class WrapperFilterParser implements FilterParser { byte[] querySource = parser.binaryValue(); 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); Filter result = context.parseInnerFilter(); parser.nextToken(); diff --git a/src/main/java/org/elasticsearch/index/query/WrapperQueryParser.java b/src/main/java/org/elasticsearch/index/query/WrapperQueryParser.java index 94732451e95..f125b512fcf 100644 --- a/src/main/java/org/elasticsearch/index/query/WrapperQueryParser.java +++ b/src/main/java/org/elasticsearch/index/query/WrapperQueryParser.java @@ -58,7 +58,7 @@ public class WrapperQueryParser implements QueryParser { byte[] querySource = parser.binaryValue(); 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); Query result = context.parseInnerQuery(); parser.nextToken();