From c4f18c36a8e2a3d742516f1a797edb2058969291 Mon Sep 17 00:00:00 2001 From: Michael Sokolov Date: Tue, 1 Oct 2024 15:39:40 -0400 Subject: [PATCH] search on proper level when connecting graph components --- .../src/java/org/apache/lucene/util/hnsw/HnswGraphBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphBuilder.java b/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphBuilder.java index 1f5253ef7f85..d3774e2aa5d6 100644 --- a/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphBuilder.java +++ b/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphBuilder.java @@ -462,7 +462,7 @@ private boolean connectComponents(int level) throws IOException { RandomVectorScorer scorer = scorerSupplier.scorer(c.start()); // find the closest node in the largest component to the lowest-numbered node in this // component that has room to make a connection - graphSearcher.searchLevel(beam, scorer, 0, eps, hnsw, notFullyConnected); + graphSearcher.searchLevel(beam, scorer, level, eps, hnsw, notFullyConnected); boolean linked = false; while (beam.size() > 0) { int c0node = beam.popNode();