john-mlika commented on code in PR #16588:
URL: https://github.com/apache/lucene/pull/16588#discussion_r3898079664
##########
lucene/core/src/java/org/apache/lucene/search/AcceptDocs.java:
##########
@@ -176,7 +176,10 @@ private static class DocIdSetIteratorAcceptDocs extends
AcceptDocs {
private void createBitSetAcceptDocsIfNecessary() throws IOException {
if (acceptBitSet == null) {
- acceptBitSet = Objects.requireNonNull(createBitSet(iterator(),
liveDocs, maxDoc));
+ // Pass the raw iterator: #createBitSet applies liveDocs itself, and
filtering upfront
+ // would hide DocIdSetIterator#intoBitSet behind a wrapper that has no
bulk implementation.
+ DocIdSetIterator iterator =
Objects.requireNonNull(iteratorSupplier.get());
Review Comment:
that was my first instinct, but the javadoc says intoBitSet must not clear
bits that are already set, and delegating then applyMask masks the whole
window, including bits a previous clause set. the accumulating callers share
one destination, BooleanScorer ORs every clause iterator into the same window
bitset, with a comment at the call site saying live docs get applied later. so
a clause that clears bits erases its siblings' hits, and doing it safely needs
a scratch bitset per window.
it also can't reach the branch you're pointing at: createBitSet only takes
that path when cost < maxDoc >> 7, and BitSet.of picks a SparseFixedBitSet at
that same cost, so intoBitSet, which only exists for FixedBitSet destinations,
is never called there. that branch walks on the order of maxDoc/128 docs anyway.
--
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]