romseygeek commented on code in PR #15954:
URL: https://github.com/apache/lucene/pull/15954#discussion_r3078452179


##########
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:
   Can we cache this somehow so that we're not doing the comparison on every 
match request?  For example, if you know that the whole block matches then you 
can just check that the current docId() is lower than the block end.



-- 
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]

Reply via email to