mirror of https://github.com/apache/lucene.git
Slight improvement/optimization to duplicate facet value checking (ref: LUCENE-9964) (#234)
This commit is contained in:
parent
645b64ef4e
commit
3037e33025
|
@ -162,14 +162,14 @@ public class LongValueFacetCounts extends Facets {
|
|||
if (limit > 0) {
|
||||
totCount++;
|
||||
}
|
||||
long previousValue = 0;
|
||||
long previousValue = -1;
|
||||
for (int i = 0; i < limit; i++) {
|
||||
long value = multiValues.nextValue();
|
||||
// do not increment the count for duplicate values
|
||||
if (i == 0 || value != previousValue) {
|
||||
if (value != previousValue) {
|
||||
increment(value);
|
||||
previousValue = value;
|
||||
}
|
||||
previousValue = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -214,14 +214,14 @@ public class LongValueFacetCounts extends Facets {
|
|||
if (limit > 0) {
|
||||
totCount++;
|
||||
}
|
||||
long previousValue = 0;
|
||||
long previousValue = -1;
|
||||
for (int i = 0; i < limit; i++) {
|
||||
long value = multiValues.nextValue();
|
||||
// do not increment the count for duplicate values
|
||||
if (i == 0 || value != previousValue) {
|
||||
if (value != previousValue) {
|
||||
increment(value);
|
||||
previousValue = value;
|
||||
}
|
||||
previousValue = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -193,8 +193,13 @@ abstract class RangeFacetCounts extends Facets {
|
|||
totCount++;
|
||||
} else {
|
||||
counter.startMultiValuedDoc();
|
||||
long previous = -1;
|
||||
for (int j = 0; j < limit; j++) {
|
||||
counter.addMultiValued(mapDocValue(multiValues.nextValue()));
|
||||
long val = mapDocValue(multiValues.nextValue());
|
||||
if (val != previous) {
|
||||
counter.addMultiValued(val);
|
||||
previous = val;
|
||||
}
|
||||
}
|
||||
if (counter.endMultiValuedDoc()) {
|
||||
totCount++;
|
||||
|
|
Loading…
Reference in New Issue