benwtrent commented on code in PR #13143:
URL: https://github.com/apache/lucene/pull/13143#discussion_r1511329799


##########
lucene/core/src/java/org/apache/lucene/search/AbstractKnnVectorQuery.java:
##########
@@ -125,24 +124,11 @@ private TopDocs getLeafResults(
       return NO_RESULTS;
     }
 
-    BitSet acceptDocs = createBitSet(scorer.iterator(), liveDocs, maxDoc);
-    final int cost = acceptDocs.cardinality();
-
-    if (cost <= k) {
-      // If there are <= k possible matches, short-circuit and perform exact 
search, since HNSW
-      // must always visit at least k documents
-      return exactSearch(ctx, new BitSetIterator(acceptDocs, cost));
-    }
-
-    // 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, 
knnCollectorManager);
-    if (results.totalHits.relation == TotalHits.Relation.EQUAL_TO) {
-      return results;
-    } else {
-      // We stopped the kNN search because it visited too many nodes, so fall 
back to exact search
-      return exactSearch(ctx, new BitSetIterator(acceptDocs, cost));
-    }

Review Comment:
   How do you handle the case when graph search early exits due to the 
visitation limit? Right now your change will return incomplete results to the 
user because we stopped exploring the graph.



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

Reply via email to