gf2121 commented on code in PR #14523:
URL: https://github.com/apache/lucene/pull/14523#discussion_r2050930797


##########
lucene/core/src/java/org/apache/lucene/search/DenseConjunctionBulkScorer.java:
##########
@@ -236,10 +236,13 @@ private void scoreWindowUsingBitSet(
       windowMatches.set(0, windowMax - windowBase);
     } else {
       DocIdSetIterator lead = iterators.get(0);
+      int intoBitSetBase = windowBase;
       if (lead.docID() < windowBase) {
-        lead.advance(windowBase);
+        intoBitSetBase = lead.advance(windowBase);
+      }
+      if (intoBitSetBase < windowMax) {
+        lead.intoBitSet(windowMax, windowMatches, intoBitSetBase);

Review Comment:
   > I still don't fully understand why we advance iterators to offset, but 
then expect the bit set to be set from that given offset.
   
   We advance offset to make sure `doc - offset` is positive, which is required 
by Bitset.
   
   > The weird bugs we are seeing are all about the interaction between 
iterators position and the offset requested (see: 
https://github.com/apache/lucene/issues/14517)
   
   Yes, I saw this when you raised this issue. I stared at the code for hours 
and still don't understand it. It looks like the competitiveIterator has 
advanced to `windowBase`, but in the next iteration, it encounters a document 
that is smaller than `windowBase`, which should not happen.



-- 
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: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to