You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by be...@apache.org on 2023/11/28 19:58:52 UTC
(lucene) branch branch_9x updated: Fix *HnswVectorsFormat.testIndexedValueNotAliased test flakiness (#12848)
This is an automated email from the ASF dual-hosted git repository.
benwtrent pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new a6d788e1138 Fix *HnswVectorsFormat.testIndexedValueNotAliased test flakiness (#12848)
a6d788e1138 is described below
commit a6d788e11381d4a26a899af32218fc9e727a124a
Author: Benjamin Trent <be...@gmail.com>
AuthorDate: Tue Nov 28 14:50:48 2023 -0500
Fix *HnswVectorsFormat.testIndexedValueNotAliased test flakiness (#12848)
---
.../lucene/tests/index/BaseKnnVectorsFormatTestCase.java | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lucene/test-framework/src/java/org/apache/lucene/tests/index/BaseKnnVectorsFormatTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/tests/index/BaseKnnVectorsFormatTestCase.java
index 35f3629c170..2b34d82d906 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/tests/index/BaseKnnVectorsFormatTestCase.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/tests/index/BaseKnnVectorsFormatTestCase.java
@@ -42,6 +42,7 @@ import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.LeafReader;
import org.apache.lucene.index.LeafReaderContext;
+import org.apache.lucene.index.NoMergePolicy;
import org.apache.lucene.index.StoredFields;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.VectorEncoding;
@@ -741,7 +742,13 @@ public abstract class BaseKnnVectorsFormatTestCase extends BaseIndexFileFormatTe
String fieldName = "field";
float[] v = {0};
try (Directory dir = newDirectory();
- IndexWriter iw = new IndexWriter(dir, newIndexWriterConfig())) {
+ IndexWriter iw =
+ new IndexWriter(
+ dir,
+ newIndexWriterConfig()
+ .setMergePolicy(NoMergePolicy.INSTANCE)
+ .setMaxBufferedDocs(3)
+ .setRAMBufferSizeMB(-1))) {
Document doc1 = new Document();
doc1.add(new KnnFloatVectorField(fieldName, v, VectorSimilarityFunction.EUCLIDEAN));
v[0] = 1;
@@ -757,6 +764,7 @@ public abstract class BaseKnnVectorsFormatTestCase extends BaseIndexFileFormatTe
try (IndexReader reader = DirectoryReader.open(iw)) {
LeafReader r = getOnlyLeafReader(reader);
FloatVectorValues vectorValues = r.getFloatVectorValues(fieldName);
+ assertEquals(3, vectorValues.size());
vectorValues.nextDoc();
assertEquals(1, vectorValues.vectorValue()[0], 0);
vectorValues.nextDoc();