zhaih commented on code in PR #12324:
URL: https://github.com/apache/lucene/pull/12324#discussion_r1212568041


##########
lucene/core/src/java/org/apache/lucene/codecs/lucene90/IndexedDISI.java:
##########
@@ -495,6 +496,7 @@ private void readBlockHeader() throws IOException {
     if (numValues <= MAX_ARRAY_LENGTH) {
       method = Method.SPARSE;
       blockEnd = slice.getFilePointer() + (numValues << 1);
+      nextExistDocInBlock = -1;
     } else if (numValues == 65536) {

Review Comment:
   Can we change this to `BLOCK_SIZE` just by the way?



##########
lucene/core/src/java/org/apache/lucene/codecs/lucene90/IndexedDISI.java:
##########
@@ -418,6 +418,7 @@ public static RandomAccessInput createJumpTable(
 
   // SPARSE variables
   boolean exists;
+  int nextExistDocInBlock = -1;

Review Comment:
   Can you add some comments explain what does -1 (unknown?) and 
Integer.MAX_VALUE (exhausted?) means?



##########
lucene/core/src/java/org/apache/lucene/codecs/lucene90/IndexedDISI.java:
##########
@@ -550,32 +552,41 @@ boolean advanceWithinBlock(IndexedDISI disi, int target) 
throws IOException {
           if (doc >= targetInBlock) {
             disi.doc = disi.block | doc;
             disi.exists = true;
+            disi.nextExistDocInBlock = doc;
             return true;
           }
         }
+        disi.nextExistDocInBlock = Integer.MAX_VALUE;

Review Comment:
   nit: I actually wonder whether we really need to set it to `MAX_VALUE` here 
(and below) since the next advance within the same block would be prevented by 
`disi.index` anyway. But set it to `MAX_VALUE` does no harm as well.



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