Invalid skipper now preserves scorerSupplier optimization

This commit is contained in:
Brian Woolfolk 2024-10-28 10:20:18 -07:00
parent 7934a3e2e1
commit 99af41dd09
1 changed files with 8 additions and 6 deletions

View File

@ -467,12 +467,14 @@ public class IndexSortSortedNumericDocValuesRangeQuery extends Query {
DocValuesSkipper skipper = context.reader().getDocValuesSkipper(field);
if (skipper != null) {
if (skipper.minValue() > upperValue || skipper.maxValue() < lowerValue) {
return null;
}
if (skipper.docCount() == context.reader().maxDoc()
&& skipper.minValue() >= lowerValue
&& skipper.maxValue() <= upperValue) {
return IteratorAndCount.all(skipper.docCount());
// Instead of returning null, act as there's no skipper.
skipper = null;
} else {
if (skipper.docCount() == context.reader().maxDoc()
&& skipper.minValue() >= lowerValue
&& skipper.maxValue() <= upperValue) {
return IteratorAndCount.all(skipper.docCount());
}
}
}