msokolov commented on code in PR #1054: URL: https://github.com/apache/lucene/pull/1054#discussion_r950423184
########## lucene/core/src/java/org/apache/lucene/search/KnnVectorQuery.java: ########## @@ -133,22 +130,21 @@ private TopDocs searchLeaf(LeafReaderContext ctx, Weight filterWeight) throws IO return NO_RESULTS; } - BitSet bitSet = createBitSet(scorer.iterator(), liveDocs, maxDoc); - BitSetIterator filterIterator = new BitSetIterator(bitSet, bitSet.cardinality()); + BitSet acceptDocs = createBitSet(scorer.iterator(), liveDocs, maxDoc); - if (filterIterator.cost() <= k) { + if (acceptDocs.cardinality() <= k) { Review Comment: I think what bothered me was that we were creating a `BitSetIterator` even when we didn't use it, except as a holder for the cost, which also we had to cast. How's this? https://github.com/apache/lucene/pull/1075 -- 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: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org