LUCENE-9613, LUCENE-10067: Add more specialization for the ordinals case.

This commit is contained in:
Adrien Grand 2021-08-25 14:34:04 +02:00
parent 45868a52f1
commit 8917fbe039

View File

@ -469,6 +469,14 @@ final class Lucene90DocValuesProducer extends DocValuesProducer {
return table[(int) values.get(doc)];
}
};
} else if (entry.gcd == 1 && entry.minValue == 0) {
// Common case for ordinals, which are encoded as numerics
return new DenseNumericDocValues(maxDoc) {
@Override
public long longValue() throws IOException {
return values.get(doc);
}
};
} else {
final long mul = entry.gcd;
final long delta = entry.minValue;
@ -522,6 +530,13 @@ final class Lucene90DocValuesProducer extends DocValuesProducer {
return table[(int) values.get(disi.index())];
}
};
} else if (entry.gcd == 1 && entry.minValue == 0) {
return new SparseNumericDocValues(disi) {
@Override
public long longValue() throws IOException {
return values.get(disi.index());
}
};
} else {
final long mul = entry.gcd;
final long delta = entry.minValue;