Skip to content

Commit

Permalink
Call HnswGraphBuilder.getCompletedGraph() in 94/95 back-compat writers (
Browse files Browse the repository at this point in the history
  • Loading branch information
msokolov authored Aug 14, 2024
1 parent a40bb39 commit 2b0c6cd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -693,9 +693,9 @@ public void addValue(int docID, Object value) throws IOException {
lastDocID = docID;
}

OnHeapHnswGraph getGraph() {
OnHeapHnswGraph getGraph() throws IOException {
if (vectors.size() > 0) {
return hnswGraphBuilder.getGraph();
return hnswGraphBuilder.getCompletedGraph();
} else {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -732,9 +732,9 @@ public void addValue(int docID, T vectorValue) throws IOException {
lastDocID = docID;
}

OnHeapHnswGraph getGraph() {
OnHeapHnswGraph getGraph() throws IOException {
if (vectors.size() > 0) {
return hnswGraphBuilder.getGraph();
return hnswGraphBuilder.getCompletedGraph();
} else {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ private static int getRandomGraphLevel(double ml, SplittableRandom random) {
}

void finish() throws IOException {
// System.out.println("finish " + frozen);
connectComponents();
frozen = true;
}
Expand All @@ -438,7 +439,7 @@ private boolean connectComponents(int level) throws IOException {
maxConn *= 2;
}
List<Component> components = HnswUtil.components(hnsw, level, notFullyConnected, maxConn);
// System.out.println("HnswGraphBuilder.connectComponents " + components);
// System.out.println("HnswGraphBuilder.connectComponents level=" + level + ": " + components);
boolean result = true;
if (components.size() > 1) {
// connect other components to the largest one
Expand Down

0 comments on commit 2b0c6cd

Please sign in to comment.