jpountz commented on code in PR #12806:
URL: https://github.com/apache/lucene/pull/12806#discussion_r1394256922


##########
lucene/core/src/java/org/apache/lucene/codecs/lucene99/Lucene99HnswVectorsReader.java:
##########
@@ -238,11 +238,23 @@ public void search(String field, float[] target, 
KnnCollector knnCollector, Bits
       return;
     }
     RandomVectorScorer scorer = flatVectorsReader.getRandomVectorScorer(field, 
target);
-    HnswGraphSearcher.search(
-        scorer,
-        new OrdinalTranslatedKnnCollector(knnCollector, scorer::ordToDoc),
-        getGraph(fieldEntry),
-        scorer.getAcceptOrds(acceptDocs));
+    if (knnCollector.k() < scorer.maxOrd()) {
+      HnswGraphSearcher.search(
+          scorer,
+          new OrdinalTranslatedKnnCollector(knnCollector, scorer::ordToDoc),
+          getGraph(fieldEntry),
+          scorer.getAcceptOrds(acceptDocs));
+      return;

Review Comment:
   nit: from a style perspective, I'd rather not return here and have an `else` 
block instead



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