Caching Weight wrappers should propagate the BulkScorer.

If we don't, then we will use the default bulk scorer, which can be
significantly slower in some cases (eg. disjunctions).

Related to https://issues.apache.org/jira/browse/LUCENE-6856
This commit is contained in:
Adrien Grand 2015-10-27 19:14:14 +01:00
parent 935a8fc3d4
commit 961df95599
1 changed files with 7 additions and 0 deletions

View File

@ -21,6 +21,7 @@ package org.elasticsearch.indices.cache.query;
import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.search.BulkScorer;
import org.apache.lucene.search.Explanation; import org.apache.lucene.search.Explanation;
import org.apache.lucene.search.LRUQueryCache; import org.apache.lucene.search.LRUQueryCache;
import org.apache.lucene.search.Query; import org.apache.lucene.search.Query;
@ -256,6 +257,12 @@ public class IndicesQueryCache extends AbstractComponent implements QueryCache,
shardKeyMap.add(context.reader()); shardKeyMap.add(context.reader());
return in.scorer(context); return in.scorer(context);
} }
@Override
public BulkScorer bulkScorer(LeafReaderContext context) throws IOException {
shardKeyMap.add(context.reader());
return in.bulkScorer(context);
}
} }
/** Clear all entries that belong to the given index. */ /** Clear all entries that belong to the given index. */