jpountz commented on code in PR #14529:
URL: https://github.com/apache/lucene/pull/14529#discussion_r2056179949


##########
lucene/core/src/java/org/apache/lucene/codecs/lucene90/IndexedDISI.java:
##########
@@ -535,6 +544,7 @@ private void readBlockHeader() throws IOException {
       method = Method.SPARSE;
       blockEnd = slice.getFilePointer() + (numValues << 1);
       nextExistDocInBlock = -1;
+      exists = false;

Review Comment:
   Is this a pre-existing bug?



##########
lucene/core/src/java/org/apache/lucene/codecs/lucene90/IndexedDISI.java:
##########
@@ -625,8 +635,36 @@ boolean advanceExactWithinBlock(IndexedDISI disi, int 
target) throws IOException
         disi.exists = false;
         return false;
       }
+
+      @Override
+      boolean intoBitsetWithinBlock(IndexedDISI disi, int upTo, FixedBitSet 
bitSet, int offset)
+          throws IOException {
+        if (disi.exists) {
+          if (disi.doc >= upTo) {
+            return true;
+          }
+          bitSet.set(disi.doc - offset);
+        }
+
+        for (int i = disi.index, to = disi.nextBlockIndex; i < to; i++) {

Review Comment:
   I am a bit surprised that this loop starts at `disi.index` instead of 
`disi.index + 1` since the doc at `disi.index` was already handled above?



##########
lucene/core/src/java/org/apache/lucene/codecs/lucene90/IndexedDISI.java:
##########
@@ -491,6 +492,14 @@ public int advance(int target) throws IOException {
     return doc;
   }
 
+  @Override
+  public void intoBitSet(int upTo, FixedBitSet bitSet, int offset) throws 
IOException {
+    assert doc >= offset;

Review Comment:
   Can you also assert something like `doc == NOT_MORE_DOCS || 
advanceExact(doc)`? It shouldn't be legal to call intoBitSet after advanceExact 
returns false (or maybe a better place for this would be asserting doc values).
   
   It looks like some implementations of `intoBitsetWithinBlock` try to cover 
the case when the current doc doesn't exist, maybe they can be simplified?



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