Merge pull request #11929 from martijnvg/percolator/drop__own_qpc_cache
The query parse context should be fetched from the IndexQueryParseService
This commit is contained in:
commit
1df8e56a83
|
@ -23,7 +23,6 @@ import org.apache.lucene.index.Term;
|
|||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.search.TermQuery;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
import org.apache.lucene.util.CloseableThreadLocal;
|
||||
import org.elasticsearch.ElasticsearchException;
|
||||
import org.elasticsearch.common.bytes.BytesReference;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -85,13 +84,6 @@ public class PercolatorQueriesRegistry extends AbstractIndexShardComponent imple
|
|||
|
||||
private boolean mapUnmappedFieldsAsString;
|
||||
|
||||
private CloseableThreadLocal<QueryParseContext> cache = new CloseableThreadLocal<QueryParseContext>() {
|
||||
@Override
|
||||
protected QueryParseContext initialValue() {
|
||||
return new QueryParseContext(shardId.index(), queryParserService);
|
||||
}
|
||||
};
|
||||
|
||||
public PercolatorQueriesRegistry(ShardId shardId, @IndexSettings Settings indexSettings, IndexQueryParserService queryParserService,
|
||||
ShardIndexingService indexingService, IndicesLifecycle indicesLifecycle, MapperService mapperService,
|
||||
IndexFieldDataService indexFieldDataService, ShardPercolateService shardPercolateService) {
|
||||
|
@ -197,7 +189,7 @@ public class PercolatorQueriesRegistry extends AbstractIndexShardComponent imple
|
|||
if (type != null) {
|
||||
QueryParseContext.setTypesWithPrevious(new String[]{type});
|
||||
}
|
||||
QueryParseContext context = cache.get();
|
||||
QueryParseContext context = queryParserService.getParseContext();
|
||||
try {
|
||||
context.reset(parser);
|
||||
// This means that fields in the query need to exist in the mapping prior to registering this query
|
||||
|
|
Loading…
Reference in New Issue