zhaih commented on code in PR #12651:
URL: https://github.com/apache/lucene/pull/12651#discussion_r1359984155


##########
lucene/core/src/java/org/apache/lucene/util/hnsw/OnHeapHnswGraph.java:
##########
@@ -74,23 +88,32 @@ public final class OnHeapHnswGraph extends HnswGraph 
implements Accountable {
    * @param node the node whose neighbors are returned, represented as an 
ordinal on the level 0.
    */
   public NeighborArray getNeighbors(int level, int node) {
-    if (level == 0) {
-      return graphLevel0.get(node);
-    }
-    Map<Integer, NeighborArray> levelMap = graphUpperLevels.get(level);
-    assert levelMap.containsKey(node);
-    return levelMap.get(node);
+    assert graph.length > node && graph[node] != null && graph[node][level] != 
null;

Review Comment:
   Yeah good idea!



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