michaeljmarshall commented on code in PR #16588:
URL: https://github.com/apache/lucene/pull/16588#discussion_r3897685412


##########
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:
   Did you consider implementing `intoBitSet` on the `FilteredDocIdSetIterator` 
object? I'm imagining something like the following in the 
`getFilteredDocIdSetIterator` method:
   
   ```java
               @Override
               public void intoBitSet(int upTo, FixedBitSet bitSet, int offset) 
throws IOException {
                 getDelegate().intoBitSet(upTo, bitSet, offset);
                 liveDocs.applyMask(bitSet, offset);
               }
   ```
   
   As it is, your solution improves performance when `iterator.cost() >= 
threshold`, but leaves the other branch without the benefit of the `intoBitSet` 
path.



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