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


##########
lucene/core/src/java/org/apache/lucene/codecs/MultiLevelSkipListReader.java:
##########
@@ -113,13 +113,14 @@ public int skipTo(int target) throws IOException {
 
     // walk up the levels until highest level is found that has a skip
     // for this target
+    // TODO: start skip docs and postings at -1 instead of 0 to avoid this 
special case on skipDoc == 0?
     int level = 0;
-    while (level < numberOfSkipLevels - 1 && target > skipDoc[level + 1]) {
+    while (level < numberOfSkipLevels - 1 && (target > skipDoc[level + 1] || 
skipDoc[level + 1] == 0)) {
       level++;
     }
 
     while (level >= 0) {
-      if (target > skipDoc[level]) {
+      if (target > skipDoc[level] || skipDoc[level] == 0) {

Review Comment:
   It's a bit annoying I had to change skip lists, but it was required so that 
skip lists and postings blocks remain aligned. Otherwise `advanceShallow(0)` 
would set `nextSkipDoc` equal to 0 instead of the last doc ID of the first 
block.



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