Apache Lucene open-source search software
LUCENE-7459: LegacyNumericDocValuesWrapper should check the value before the bits for docs that have a value.
Adrien Grandd0ff2d273517
diff --git a/lucene/core/src/java/org/apache/lucene/index/LegacyNumericDocValuesWrapper.java b/lucene/core/src/java/org/apache/lucene/index/LegacyNumericDocValuesWrapper.javaindex d9c997c3c1b..64108e178c2 100644--- a/lucene/core/src/java/org/apache/lucene/index/LegacyNumericDocValuesWrapper.java+++ b/lucene/core/src/java/org/apache/lucene/index/LegacyNumericDocValuesWrapper.java@@ -30,6 +30,7 @@ public final class LegacyNumericDocValuesWrapper extends NumericDocValues {private final LegacyNumericDocValues values;private final int maxDoc;private int docID = -1;+ private long value;public LegacyNumericDocValuesWrapper(Bits docsWithField, LegacyNumericDocValues values) {this.docsWithField = docsWithField;@@ -51,7 +52,8 @@ public final class LegacyNumericDocValuesWrapper extends NumericDocValues {public int nextDoc() {docID++;while (docID < maxDoc) {- if (docsWithField.get(docID)) {+ value = values.get(docID);+ if (value != 0 || docsWithField.get(docID)) {return docID;}docID++;@@ -82,7 +84,7 @@ public final class LegacyNumericDocValuesWrapper extends NumericDocValues {@Overridepublic long longValue() {- return values.get(docID);+ return value;}@Override