sgup432 commented on code in PR #15954:
URL: https://github.com/apache/lucene/pull/15954#discussion_r3083897262
##########
lucene/core/src/java/org/apache/lucene/document/SortedNumericDocValuesRangeQuery.java:
##########
@@ -136,16 +136,88 @@ public ScorerSupplier scorerSupplier(LeafReaderContext
context) throws IOExcepti
SortedNumericDocValues values =
DocValues.getSortedNumeric(context.reader(), field);
final NumericDocValues singleton = DocValues.unwrapSingleton(values);
final DocValuesSkipper skipper =
context.reader().getDocValuesSkipper(field);
- TwoPhaseIterator iterator;
- if (singleton != null) {
- if (skipper != null) {
- final DocIdSetIterator psIterator =
- getDocIdSetIteratorOrNullForPrimarySort(context.reader(),
singleton, skipper);
- if (psIterator != null) {
- return ConstantScoreScorerSupplier.fromIterator(
- psIterator, score(), scoreMode, maxDoc);
- }
+
+ if (singleton != null && skipper != null) {
+ final DocIdSetIterator psIterator =
+ getDocIdSetIteratorOrNullForPrimarySort(context.reader(),
singleton, skipper);
+ if (psIterator != null) {
+ return ConstantScoreScorerSupplier.fromIterator(psIterator,
score(), scoreMode, maxDoc);
}
+ }
+
+ TwoPhaseIterator iterator;
+ if (skipper != null) {
+ // Use SkipBlockRangeIterator as the approximation: block-level skip
+ // filtering with no DV decoding. This exposes block skips to
+ // ConjunctionDISI so that when one field's block is NO, other fields
+ // never decode DV data for that block.
+ final SkipBlockRangeIterator skipApprox =
+ new SkipBlockRangeIterator(skipper, lowerValue, upperValue);
+ iterator =
+ new TwoPhaseIterator(skipApprox) {
+ @Override
+ public boolean matches() throws IOException {
+ int blockMatch = classifyBlock();
Review Comment:
Yes this makes sense to me. Actually I had thought of this earlier as well
in my initial implementation but somehow missed this. Added
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]