clean the query parse context after usage
that will make sure we don't have any parsers lying around that are no longer used
This commit is contained in:
parent
047119d92e
commit
6a2bb9a35e
|
@ -270,18 +270,26 @@ public class IndexQueryParserService extends AbstractIndexComponent {
|
|||
public ParsedFilter parseInnerFilter(XContentParser parser) throws IOException {
|
||||
QueryParseContext context = cache.get();
|
||||
context.reset(parser);
|
||||
try {
|
||||
Filter filter = context.parseInnerFilter();
|
||||
if (filter == null) {
|
||||
return null;
|
||||
}
|
||||
return new ParsedFilter(filter, context.copyNamedFilters());
|
||||
} finally {
|
||||
context.reset(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Query parseInnerQuery(XContentParser parser) throws IOException {
|
||||
QueryParseContext context = cache.get();
|
||||
context.reset(parser);
|
||||
try {
|
||||
return context.parseInnerQuery();
|
||||
} finally {
|
||||
context.reset(null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -315,6 +323,7 @@ public class IndexQueryParserService extends AbstractIndexComponent {
|
|||
|
||||
private ParsedQuery parse(QueryParseContext parseContext, XContentParser parser) throws IOException, QueryParsingException {
|
||||
parseContext.reset(parser);
|
||||
try {
|
||||
if (strict) {
|
||||
parseContext.parseFlags(EnumSet.of(ParseField.Flag.STRICT));
|
||||
}
|
||||
|
@ -323,6 +332,9 @@ public class IndexQueryParserService extends AbstractIndexComponent {
|
|||
query = Queries.newMatchNoDocsQuery();
|
||||
}
|
||||
return new ParsedQuery(query, parseContext.copyNamedFilters());
|
||||
} finally {
|
||||
parseContext.reset(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void add(Map<String, FilterParser> map, FilterParser filterParser) {
|
||||
|
|
Loading…
Reference in New Issue