shubhamvishu commented on code in PR #15592:
URL: https://github.com/apache/lucene/pull/15592#discussion_r2711332758


##########
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:
   There were test failures on this codepath(expecting `#getBitset` to be 
called) but we can change it to instead check `#cost` is called correctly. I 
like it how it would simplify this given `BitSetIterator` stores the cost at 
creation time. I'll simplify this.



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