zhaih commented on code in PR #12651: URL: https://github.com/apache/lucene/pull/12651#discussion_r1359572233
########## lucene/core/src/java/org/apache/lucene/util/hnsw/OnHeapHnswGraph.java: ########## @@ -163,45 +185,66 @@ public NodesIterator getNodesOnLevel(int level) { if (level == 0) { return new ArrayNodesIterator(size()); } else { - return new CollectionNodesIterator(graphUpperLevels.get(level).keySet()); + generateLevelToNodes(); + return new CollectionNodesIterator(levelToNodes[level]); } } + @SuppressWarnings({"unchecked", "rawtypes"}) + private void generateLevelToNodes() { Review Comment: Yeah I hope it's a good compromise. I added some more javadoc to `getNodesOnLevel` to explain the behavior and risk of using the method -- 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