jpountz opened a new pull request, #12810:
URL: https://github.com/apache/lucene/pull/12810

   Currently `advance(int target)` needs to perform two checks:
    - is there a need to use skip lists?
    - is there a need for decoding a new block?
   
   Ideally we would track the last doc ID in a block and use it to check these 
two things with a single comparison. However neither `accum` nor `nextSkipDoc` 
are suitable for this because they both start at 0, so `advance(0)` on an 
postings enum that is not initialized would think that it doesn't need to 
decode a new block while it does.
   
   Instead of introducing a 3rd variable, this PR changes postings and skip 
lists to start at -1 so that checking `target > accum` is enough to know 
whether skip lists may need to be advanced and a new block needs to be decoded. 
Specifically, check out changes to `BlockImpactsEnum#advance` which is now 
simpler.
   
   This feels like a good change anyway, as now a value that would be present 
in every single document would be able to take advantage of the `allEqual` 
optimization on the first block, which currently fails because the first doc 
delta is 0, while all other deltas are 1.
   
   This also enabled a few other simplifications, see e.g. `BlockDocsEnum` and 
`EverythingEnum`, which no longer need to track the `nextSkipDoc` and can do 
everything they need using `accum`.


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