parkertimmins commented on code in PR #16450:
URL: https://github.com/apache/lucene/pull/16450#discussion_r3705214035


##########
lucene/core/src/java/org/apache/lucene/search/DocValuesRangeIterator.java:
##########
@@ -286,14 +287,26 @@ final boolean advanceDisi(int target) throws IOException {
       return disi.advance(target) == target;
     }
 
+    final boolean recordMatch(boolean matches) {
+      lastMatchingDoc = matches ? blockIterator.docID() : -1;
+      return matches;
+    }
+
+    final int confirmedDocRunEnd() {
+      int doc = blockIterator.docID();
+      return lastMatchingDoc == doc ? doc + 1 : doc;
+    }
+
     @Override
     public boolean matches() throws IOException {
-      return advanceDisi(blockIterator.docID()) && predicate.get();
+      return recordMatch(advanceDisi(blockIterator.docID()) && 
predicate.get());
     }
 
     @Override
     public int docIDRunEnd() throws IOException {
-      return blockIterator.docID() + 1;
+      // Even a YES block only proves membership in the ordinal set's bounding 
range, not in the
+      // potentially non-contiguous set itself.
+      return confirmedDocRunEnd();

Review Comment:
   Agreed the additional complexity isn't worth it



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