You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "benwtrent (via GitHub)" <gi...@apache.org> on 2025/08/04 15:24:41 UTC
Re: [PR] Make BitSet no longer implement Bits. [lucene]
benwtrent commented on code in PR #14996:
URL: https://github.com/apache/lucene/pull/14996#discussion_r2251829915
##########
lucene/core/src/java/org/apache/lucene/search/AbstractKnnVectorQuery.java:
##########
@@ -214,7 +214,9 @@ private TopDocs getLeafResults(
// Perform the approximate kNN search
// We pass cost + 1 here to account for the edge case when we explore exactly cost vectors
- TopDocs results = approximateSearch(ctx, acceptDocs, cost + 1, timeLimitingKnnCollectorManager);
+ TopDocs results =
+ approximateSearch(
+ ctx, acceptDocs.asReadOnlyBits(), cost + 1, timeLimitingKnnCollectorManager);
Review Comment:
Within the HNSW format, we do this:
```
if (acceptDocs instanceof BitSet bitSet) {
// Use approximate cardinality as this is good enough, but ensure we don't exceed the graph
// size as that is illogical
filteredDocCount = Math.min(bitSet.approximateCardinality(), graph.size());
if (unfilteredVisit >= filteredDocCount) {
doHnsw = false;
}
}
```
We determine the filter size via casting the `Bits` to `BitSet`. So, I am not sure we can make this change without progressing: https://github.com/apache/lucene/pull/15011
Or `bits` should give cardinality information...
--
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-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org