cpoerschke commented on code in PR #14084:
URL: https://github.com/apache/lucene/pull/14084#discussion_r1901977429


##########
lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphSearcher.java:
##########
@@ -67,7 +70,21 @@ public static void search(
     HnswGraphSearcher graphSearcher =
         new HnswGraphSearcher(
             new NeighborQueue(knnCollector.k(), true), new 
SparseFixedBitSet(getGraphSize(graph)));
-    search(scorer, knnCollector, graph, graphSearcher, acceptOrds);
+    final int[] entryPoints;
+    if (knnCollector instanceof EntryPointProvider epp) {
+      DocIdSetIterator eps = epp.entryPoints();
+      entryPoints = new int[(int) eps.cost()];
+      int idx = 0;
+      int entryPointOrdInt;
+      while ((entryPointOrdInt = eps.nextDoc()) != NO_MORE_DOCS) {
+        entryPoints[idx++] = entryPointOrdInt;
+      }
+      // We use provided entry point ordinals to search the complete graph 
(level 0)
+      graphSearcher.searchLevel(
+          knnCollector, scorer, 0 /* level */, entryPoints, graph, acceptOrds);

Review Comment:
   Maybe check that `entryPoints` contains at least element.



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