Pulkitg64 commented on code in PR #16403:
URL: https://github.com/apache/lucene/pull/16403#discussion_r3604352436


##########
lucene/core/src/test/org/apache/lucene/index/TestHnswGraphReuse.java:
##########
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.index;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.KnnFloatVectorField;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.tests.util.LuceneTestCase;
+import org.apache.lucene.tests.util.TestUtil;
+import org.apache.lucene.util.InfoStream;
+
+/**
+ * Tests that merging deletion-free segments under the default codec reuses 
their existing HNSW
+ * graphs instead of rebuilding the merged graph from scratch. The default 
codec wires vector
+ * readers through {@code PerFieldKnnVectorsFormat.FieldsReader}, the wrapper 
that {@code
+ * IncrementalHnswGraphMerger#addReader} must unwrap for reuse to trigger.
+ *
+ * <p>The assertion keys on the InfoStream message of {@code 
MergingHnswGraphBuilder}, used by the
+ * single threaded merger that the default format selects ({@code 
numMergeWorkers} is 1).
+ */
+public class TestHnswGraphReuse extends LuceneTestCase {
+
+  private static final int DIM = 8;
+  private static final int SEGMENTS = 2;
+
+  /**
+   * Above the tiny-segment cutoff of {@code 
Lucene99HnswVectorsWriter#shouldCreateGraph} (about 650

Review Comment:
   Do you think it's worth to make it explicit rather than relying on default 
threshold assumption like done here: 
https://github.com/apache/lucene/pull/15419/changes ?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to