epotyom commented on code in PR #16510:
URL: https://github.com/apache/lucene/pull/16510#discussion_r3893844761


##########
lucene/core/src/java/org/apache/lucene/search/IndexSortSortedNumericDocValuesRangeQuery.java:
##########
@@ -700,5 +701,26 @@ public int advance(int target) throws IOException {
     public long cost() {
       return Math.min(delegate.cost(), lastDoc - firstDoc);
     }
+
+    @Override
+    public void intoBitSet(int upTo, FixedBitSet bitSet, int offset) throws 
IOException {
+      assert offset <= doc;

Review Comment:
   [nit] Maybe also assert that the bitset is positioned, i.e. doc >= firstDoc?



##########
lucene/core/src/java/org/apache/lucene/util/NotDocIdSet.java:
##########
@@ -84,6 +84,27 @@ public int docIDRunEnd() {
         return Math.min(nextSkippedDoc, maxDoc);
       }
 
+      @Override
+      public void intoBitSet(int upTo, FixedBitSet bitSet, int offset) throws 
IOException {
+        assert offset <= doc;
+        int boundedUpTo = Math.min(upTo, maxDoc);
+        while (doc < boundedUpTo) {
+          if (doc < nextSkippedDoc) {
+            // [doc, nextSkippedDoc) is a run of matches.
+            int runEnd = Math.min(nextSkippedDoc, boundedUpTo);
+            bitSet.set(doc - offset, runEnd - offset);
+            doc = runEnd;
+          }
+          while (doc == nextSkippedDoc) {

Review Comment:
   Given that base class has a requirement `This should behave exactly as if 
implemented as below` and that `nextDoc() -> advance()` used in the default 
implementation checks `doc >= maxDoc` on every iteration of its internal loop, 
should we add this condition to this loop here? Might also make this loop 
somewhat faster for a corner case where inIterator.nextDoc() keeps returning 
doc+1 and all of them are greater than maxDoc.



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