You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by so...@apache.org on 2025/01/09 12:23:13 UTC

(lucene) branch main updated: Preserve max-conn when merging onto existing graph Fixes gh#14118 (#14121)

This is an automated email from the ASF dual-hosted git repository.

sokolov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/main by this push:
     new 2afc0a0f8b8 Preserve max-conn when merging onto existing graph Fixes gh#14118 (#14121)
2afc0a0f8b8 is described below

commit 2afc0a0f8b8c61fe5d36f705fe27413adbb6962a
Author: Michael Sokolov <so...@falutin.net>
AuthorDate: Thu Jan 9 07:23:07 2025 -0500

    Preserve max-conn when merging onto existing graph Fixes gh#14118 (#14121)
---
 .../org/apache/lucene/codecs/lucene99/Lucene99HnswVectorsWriter.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene99/Lucene99HnswVectorsWriter.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene99/Lucene99HnswVectorsWriter.java
index ce9ee1b79cc..a587449e2e7 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene99/Lucene99HnswVectorsWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene99/Lucene99HnswVectorsWriter.java
@@ -452,11 +452,12 @@ public final class Lucene99HnswVectorsWriter extends KnnVectorsWriter {
     meta.writeVLong(vectorIndexLength);
     meta.writeVInt(field.getVectorDimension());
     meta.writeInt(count);
-    meta.writeVInt(M);
     // write graph nodes on each level
     if (graph == null) {
+      meta.writeVInt(M);
       meta.writeVInt(0);
     } else {
+      meta.writeVInt(graph.maxConn());
       meta.writeVInt(graph.numLevels());
       long valueCount = 0;
       for (int level = 0; level < graph.numLevels(); level++) {