tteofili commented on code in PR #15500:
URL: https://github.com/apache/lucene/pull/15500#discussion_r2618966251


##########
lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphSearcher.java:
##########
@@ -277,25 +287,16 @@ void searchLevel(
 
     int size = getGraphSize(graph);
 
-    prepareScratchState(size);
-
-    if (bulkNodes == null || bulkNodes.length < graph.maxConn() * 2) {
-      bulkNodes = new int[graph.maxConn() * 2];
-      bulkScores = new float[graph.maxConn() * 2];
+    prepareScratchState(size, graph.maxConn() * 2);
+    if (bulkScores == null || bulkScores.length < eps.length) {
+      bulkScores = new float[eps.length];
     }
-
-    for (int ep : eps) {
-      if (visited.getAndSet(ep) == false) {
-        if (results.earlyTerminated()) {
-          break;
-        }
-        float score = scorer.score(ep);
-        results.incVisitedCount(1);
-        candidates.add(ep, score);
-        if (acceptOrds == null || acceptOrds.get(ep)) {
-          results.collect(ep, score);
-        }
-      }
+    if (results.earlyTerminated()) {
+      return;
+    }

Review Comment:
   as noted by @john-wagster 
[here](https://github.com/apache/lucene/pull/15500/changes#r2616025867), this 
seems to change a bit the logic for early termination at the entry point level. 
afaiau, this should be ok in most of the cases because early terminating at 
entry point is very very unlikely.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to