HUSTERGS commented on code in PR #15592:
URL: https://github.com/apache/lucene/pull/15592#discussion_r2711201683
##########
lucene/core/src/java/org/apache/lucene/search/AcceptDocs.java:
##########
@@ -189,17 +189,23 @@ public Bits bits() throws IOException {
@Override
public int cost() throws IOException {
- createBitSetAcceptDocsIfNecessary();
- return cardinality;
+ if (acceptBitSet != null) {
+ return cardinality;
+ }
+ DocIdSetIterator iterator = iterator();
+ if (liveDocs == null && iterator instanceof BitSetIterator
bitSetIterator) {
Review Comment:
Why we need to check whether the iterator is BitSetIterator ? Can we always
return the `iterator.cost()`? BitSetIterator#cost() can iternally handle the
call?
##########
lucene/core/src/java/org/apache/lucene/search/AcceptDocs.java:
##########
@@ -189,17 +189,23 @@ public Bits bits() throws IOException {
@Override
public int cost() throws IOException {
- createBitSetAcceptDocsIfNecessary();
Review Comment:
If we remove this line, we should also change the comment above
DocIdSetIteratorAcceptDocs ?
--
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]