mirror of https://github.com/apache/lucene.git
SOLR-9726: Reduce number of lookupOrd calls made by the DocValuesFacets.getCounts method. (Jonny Marks via Christine Poerschke)
This commit is contained in:
parent
7fb72bfe10
commit
cbf8235e57
|
@ -109,6 +109,9 @@ Optimizations
|
|||
* SOLR-9704: Facet Module / JSON Facet API: Optimize blockChildren facets that have
|
||||
filters specified by using those filters as acceptDocs. (yonik)
|
||||
|
||||
* SOLR-9726: Reduce number of lookupOrd calls made by the DocValuesFacets.getCounts method.
|
||||
(Jonny Marks via Christine Poerschke)
|
||||
|
||||
Bug Fixes
|
||||
----------------------
|
||||
* SOLR-9701: NPE in export handler when "fl" parameter is omitted.
|
||||
|
|
|
@ -173,17 +173,18 @@ public class DocValuesFacets {
|
|||
int min=mincount-1; // the smallest value in the top 'N' values
|
||||
for (int i=(startTermIndex==-1)?1:0; i<nTerms; i++) {
|
||||
int c = counts[i];
|
||||
if (contains != null) {
|
||||
final BytesRef term = si.lookupOrd(startTermIndex+i);
|
||||
if (!SimpleFacets.contains(term.utf8ToString(), contains, ignoreCase)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (c>min) {
|
||||
// NOTE: we use c>min rather than c>=min as an optimization because we are going in
|
||||
// index order, so we already know that the keys are ordered. This can be very
|
||||
// important if a lot of the counts are repeated (like zero counts would be).
|
||||
|
||||
if (contains != null) {
|
||||
final BytesRef term = si.lookupOrd(startTermIndex+i);
|
||||
if (!SimpleFacets.contains(term.utf8ToString(), contains, ignoreCase)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// smaller term numbers sort higher, so subtract the term number instead
|
||||
long pair = (((long)c)<<32) + (Integer.MAX_VALUE - i);
|
||||
boolean displaced = queue.insert(pair);
|
||||
|
|
Loading…
Reference in New Issue