LUCENE-10598: Fix docValueCount() on Lucene80 sparse sorted set doc values.

This commit is contained in:
Adrien Grand 2022-06-02 09:33:04 +02:00
parent ee99a2a452
commit 267a5fcc15
1 changed files with 12 additions and 5 deletions

View File

@ -1653,15 +1653,21 @@ final class Lucene80DocValuesProducer extends DocValuesProducer {
return disi.advanceExact(target); return disi.advanceExact(target);
} }
@Override private boolean set() {
public long nextOrd() throws IOException {
if (set == false) { if (set == false) {
final int index = disi.index(); final int index = disi.index();
final long start = addresses.get(index); start = addresses.get(index);
this.start = start + 1;
end = addresses.get(index + 1L); end = addresses.get(index + 1L);
set = true; set = true;
return ords.get(start); return true;
}
return false;
}
@Override
public long nextOrd() throws IOException {
if (set()) {
return ords.get(start++);
} else if (start == end) { } else if (start == end) {
return NO_MORE_ORDS; return NO_MORE_ORDS;
} else { } else {
@ -1671,6 +1677,7 @@ final class Lucene80DocValuesProducer extends DocValuesProducer {
@Override @Override
public long docValueCount() { public long docValueCount() {
set();
return end - start; return end - start;
} }
}; };