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


##########
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:
   I added assertions and stricter checks upstream of this



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