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

   `DocValuesRangeIterator` uses `SkipBlockRangeIterator` as a two-phase 
approximation. Docs in `MAYBE` and `YES_IF_PRESENT` blocks belong to the 
approximation, but are not necessarily query matches. `docIDRunEnd()` could 
previously expose these approximation runs as actual matching runs. Consumers 
could then treat unconfirmed docs as matches. 
   
   This change modifies the `docIDRunEnd` implementations in 
`DocValuesBlockRangeIterator` and `BulkBlockRangeIterator` to avoid returns too 
large of a set from `docIDRunEnd`. This means instead of returning 
`approximation.docID + 1`, which implies that the current docId is a match, we 
return `approximation.docID`. This means the run is empty. Always 
`approximation.docID` would be correct, but is overly conservative. Thus we 
store the last matching docID. If it is the same docID as 
`approximation.docID`, we return `docID+1` mean it was match. Otherwise, we 
return `docID`, meaning no match.
   
   This change also makes the `SkipBlockRangeIterator.docIDRunEnd` less 
conservative. It had previously returned `docID+1` for MAYBE and YES_IF_PRESENT 
blocks. But the `SkipBlockRangeIterator` is a set of docID's that are either 
YES, YES_IF_PRESENT, or MAYBE. That is, from the perspective of 
`SkipBlockRangeIterator`, are docID with MAYBE is a valid member of it's DISI 
set. Thus `docIDRunEnd` should treat a MAYBE doc as a match.
   
   (This differs from `DocValuesBlockRangeIterator` and 
`BulkBlockRangeIterator`  which are two phase iterators. The set they expose 
has to remove the MAYBEs, thus should not include them in `docIDRunEnd`.)
   
   
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to