Skip to content

Apache Lucene open-source search software

search on proper level when connecting graph components (#13846)

Michael Sokolov3ede9de6aa23
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 317814e4604..75b579f0bd9 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
@@ -470,7 +470,7 @@ public class HnswGraphBuilder implements HnswBuilder {
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();