mirror of https://github.com/apache/lucene.git
LUCENE-10047: Fix value de-duping check in LongValueFacetCounts and RangeFacetCounts (#237)
This commit is contained in:
parent
e937e739f3
commit
a11457b4e6
|
@ -281,6 +281,9 @@ Bug fixes
|
||||||
* LUCENE-9823: Prevent unsafe rewrites for SynonymQuery and CombinedFieldQuery. Before, rewriting
|
* LUCENE-9823: Prevent unsafe rewrites for SynonymQuery and CombinedFieldQuery. Before, rewriting
|
||||||
could slightly change the scoring when weights were specified. (Naoto Minami via Julie Tibshirani)
|
could slightly change the scoring when weights were specified. (Naoto Minami via Julie Tibshirani)
|
||||||
|
|
||||||
|
* LUCENE-10047: Fix a value de-duping bug in LongValueFacetCounts and RangeFacetCounts
|
||||||
|
(Greg Miller)
|
||||||
|
|
||||||
Changes in Backwards Compatibility Policy
|
Changes in Backwards Compatibility Policy
|
||||||
|
|
||||||
* LUCENE-9904: regenerated UAX29URLEmailTokenizer and the corresponding analyzer with up-to-date top
|
* LUCENE-9904: regenerated UAX29URLEmailTokenizer and the corresponding analyzer with up-to-date top
|
||||||
|
|
|
@ -162,11 +162,11 @@ public class LongValueFacetCounts extends Facets {
|
||||||
if (limit > 0) {
|
if (limit > 0) {
|
||||||
totCount++;
|
totCount++;
|
||||||
}
|
}
|
||||||
long previousValue = -1;
|
long previousValue = 0;
|
||||||
for (int i = 0; i < limit; i++) {
|
for (int i = 0; i < limit; i++) {
|
||||||
long value = multiValues.nextValue();
|
long value = multiValues.nextValue();
|
||||||
// do not increment the count for duplicate values
|
// do not increment the count for duplicate values
|
||||||
if (value != previousValue) {
|
if (i == 0 || value != previousValue) {
|
||||||
increment(value);
|
increment(value);
|
||||||
previousValue = value;
|
previousValue = value;
|
||||||
}
|
}
|
||||||
|
@ -214,11 +214,11 @@ public class LongValueFacetCounts extends Facets {
|
||||||
if (limit > 0) {
|
if (limit > 0) {
|
||||||
totCount++;
|
totCount++;
|
||||||
}
|
}
|
||||||
long previousValue = -1;
|
long previousValue = 0;
|
||||||
for (int i = 0; i < limit; i++) {
|
for (int i = 0; i < limit; i++) {
|
||||||
long value = multiValues.nextValue();
|
long value = multiValues.nextValue();
|
||||||
// do not increment the count for duplicate values
|
// do not increment the count for duplicate values
|
||||||
if (value != previousValue) {
|
if (i == 0 || value != previousValue) {
|
||||||
increment(value);
|
increment(value);
|
||||||
previousValue = value;
|
previousValue = value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,10 +193,10 @@ abstract class RangeFacetCounts extends Facets {
|
||||||
totCount++;
|
totCount++;
|
||||||
} else {
|
} else {
|
||||||
counter.startMultiValuedDoc();
|
counter.startMultiValuedDoc();
|
||||||
long previous = -1;
|
long previous = 0;
|
||||||
for (int j = 0; j < limit; j++) {
|
for (int j = 0; j < limit; j++) {
|
||||||
long val = mapDocValue(multiValues.nextValue());
|
long val = mapDocValue(multiValues.nextValue());
|
||||||
if (val != previous) {
|
if (j == 0 || val != previous) {
|
||||||
counter.addMultiValued(val);
|
counter.addMultiValued(val);
|
||||||
previous = val;
|
previous = val;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue