kkewwei opened a new pull request, #16952: URL: https://github.com/apache/lucene/pull/16952
### Description Some calls assume that incoming docId stays within the leaf's `maxDoc`. https://github.com/apache/lucene/blob/main/lucene/core/src/java/org/apache/lucene/internal/vectorization/DefaultDocValuesRangeSupport.java#L39 https://github.com/apache/lucene/blob/main/lucene/test-framework/src/java/org/apache/lucene/tests/index/AssertingLeafReader.java#L808 However, several callers pass `NO_MORE_DOCS` as the upper bound, which can lead to out-of-bounds. Incorrect `maxDoc` have previously affected performance (#16855), and I encountered an out-of-bounds while working on #16897. This change uses the leaf's `maxDoc` as the upper bound at these call sites and clamps the bound in `IndexSearcher.searchLeaf()`. This change does not prohibit passing DocIdSetIterator.NO_MORE_DOCS as the upper bound. It only updates the existing call sites to use the segment's maxDoc, avoiding unnecessarily large bounds in these paths. <!-- If this is your first contribution to Lucene, please make sure you have reviewed the contribution guide. https://github.com/apache/lucene/blob/main/CONTRIBUTING.md --> -- 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]
