kaivalnp commented on code in PR #12820:
URL: https://github.com/apache/lucene/pull/12820#discussion_r1399829891


##########
lucene/core/src/java/org/apache/lucene/search/KnnFloatVectorQuery.java:
##########
@@ -76,11 +73,11 @@ public KnnFloatVectorQuery(String field, float[] target, 
int k, Query filter) {
   }
 
   @Override
-  protected TopDocs approximateSearch(LeafReaderContext context, Bits 
acceptDocs, int visitedLimit)
-      throws IOException {
-    TopDocs results =
-        context.reader().searchNearestVectors(field, target, k, acceptDocs, 
visitedLimit);
-    return results != null ? results : NO_RESULTS;
+  protected void approximateSearch(
+      LeafReaderContext context, Bits acceptDocs, KnnCollector collector) 
throws IOException {
+    if (collector != null) {

Review Comment:
   This is [extended by the 
`DiversifyingChildrenFloatKnnVectorQuery`](https://github.com/kaivalnp/lucene/blob/7eb8f6ee00f4da234e3c0ce1cfc331683fe4c3de/lucene/join/src/java/org/apache/lucene/search/join/DiversifyingChildrenFloatKnnVectorQuery.java#L52)
 which can have `null` collectors. Perhaps we can remove the check here, but 
again override it from the sub-class and include this check?
   
   I just added this because users may tend to extend `KnnFloatVectorQuery` for 
custom implementations, and need not worry about the collector being `null`



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