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


##########
lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90DocValuesProducer.java:
##########
@@ -1205,7 +1205,15 @@ public SeekStatus seekCeil(BytesRef text) throws 
IOException {
           ord = 0;
           return SeekStatus.END;
         } else {
-          seekExact(0L);
+          // seekBlock doesn't update ord and it repositions bytes when calls 
getFirstTermFromBlock

Review Comment:
   So, I think the ultimate reason might be previously when we call 
`seekExact(0)`, this if condition is not true, and thus the `bytes` and `ord` 
are not reset correctly.
   ```
         if (ord < this.ord || blockIndex != currentBlockIndex) {
           // The looked up ord is before the current ord or belongs to a 
different block, seek again
           final long blockAddress = blockAddresses.get(blockIndex);
           bytes.seek(blockAddress);
           this.ord = (blockIndex << TERMS_DICT_BLOCK_LZ4_SHIFT) - 1;
         }
   ```
   So I would prefer we do
   ```
   ord = 1; // Probably need to add some comments on why we do this weird thing
   seekExact(0L);
   ```
   Instead of doing it manually here in case we're changing the seek behavior 
in the future.



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