LUCENE-7459: LegacyNumericDocValuesWrapper should check the value before the bits for docs that have a value.

This commit is contained in:
Adrien Grand 2016-10-03 09:14:06 +02:00
parent cc4c780227
commit d0ff2d2735
1 changed files with 4 additions and 2 deletions

View File

@ -30,6 +30,7 @@ public final class LegacyNumericDocValuesWrapper extends NumericDocValues {
private final LegacyNumericDocValues values; private final LegacyNumericDocValues values;
private final int maxDoc; private final int maxDoc;
private int docID = -1; private int docID = -1;
private long value;
public LegacyNumericDocValuesWrapper(Bits docsWithField, LegacyNumericDocValues values) { public LegacyNumericDocValuesWrapper(Bits docsWithField, LegacyNumericDocValues values) {
this.docsWithField = docsWithField; this.docsWithField = docsWithField;
@ -51,7 +52,8 @@ public final class LegacyNumericDocValuesWrapper extends NumericDocValues {
public int nextDoc() { public int nextDoc() {
docID++; docID++;
while (docID < maxDoc) { while (docID < maxDoc) {
if (docsWithField.get(docID)) { value = values.get(docID);
if (value != 0 || docsWithField.get(docID)) {
return docID; return docID;
} }
docID++; docID++;
@ -82,7 +84,7 @@ public final class LegacyNumericDocValuesWrapper extends NumericDocValues {
@Override @Override
public long longValue() { public long longValue() {
return values.get(docID); return value;
} }
@Override @Override