mirror of
https://github.com/apache/lucene.git
synced 2025-02-07 02:28:49 +00:00
LUCENE-10346: Specially treat SingletonSortedNumericDocValues in FastTaxonomyFacetCounts#countAll() (#574)
This commit is contained in:
parent
da3992b16f
commit
01f5e7bb7b
@ -106,6 +106,8 @@ Optimizations
|
||||
asked to -- typically never. This fixes a performance regression since 7.3 LUCENE-8099 when some
|
||||
older boosting queries were replaced with this. (David Smiley)
|
||||
|
||||
* LUCENE-10346: Optimize facet counting for single-valued TaxonomyFacetCounts. (Guo Feng)
|
||||
|
||||
Bug Fixes
|
||||
---------------------
|
||||
|
||||
|
@ -23,8 +23,10 @@ import org.apache.lucene.facet.FacetUtils;
|
||||
import org.apache.lucene.facet.FacetsCollector;
|
||||
import org.apache.lucene.facet.FacetsCollector.MatchingDocs;
|
||||
import org.apache.lucene.facet.FacetsConfig;
|
||||
import org.apache.lucene.index.DocValues;
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.index.LeafReaderContext;
|
||||
import org.apache.lucene.index.NumericDocValues;
|
||||
import org.apache.lucene.index.SortedNumericDocValues;
|
||||
import org.apache.lucene.search.ConjunctionUtils;
|
||||
import org.apache.lucene.search.DocIdSetIterator;
|
||||
@ -98,6 +100,17 @@ public class FastTaxonomyFacetCounts extends IntTaxonomyFacets {
|
||||
|
||||
Bits liveDocs = context.reader().getLiveDocs();
|
||||
|
||||
NumericDocValues ndv = DocValues.unwrapSingleton(dv);
|
||||
if (ndv != null) {
|
||||
for (int doc = ndv.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = ndv.nextDoc()) {
|
||||
if (liveDocs != null && liveDocs.get(doc) == false) {
|
||||
continue;
|
||||
}
|
||||
increment((int) ndv.longValue());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int doc = dv.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = dv.nextDoc()) {
|
||||
if (liveDocs != null && liveDocs.get(doc) == false) {
|
||||
continue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user