From 53d1c2bd2fb3e6b9da590bee360996dbbdc8ea34 Mon Sep 17 00:00:00 2001 From: ChrisHegarty Date: Fri, 20 Sep 2024 15:27:38 +0100 Subject: [PATCH] Test fix: make float vector dims even for SQ testing --- .../lucene/tests/index/BaseKnnVectorsFormatTestCase.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 fd8259e2636..63fe2b8f4c1 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 @@ -1817,7 +1817,7 @@ public abstract class BaseKnnVectorsFormatTestCase extends BaseIndexFileFormatTe Directory dir1 = newDirectory(); IndexWriter w1 = new IndexWriter(dir1, newIndexWriterConfig()); Document doc = new Document(); - doc.add(new KnnFloatVectorField("float", new float[] {1f})); + doc.add(new KnnFloatVectorField("float", new float[] {1f, 2f})); doc.add(new KnnByteVectorField("byte", new byte[] {42})); w1.addDocument(doc); @@ -1849,12 +1849,14 @@ public abstract class BaseKnnVectorsFormatTestCase extends BaseIndexFileFormatTe assertNotNull(floatVectors); assertEquals(0, floatVectors.nextDoc()); float[] vector = floatVectors.vectorValue(); - assertEquals(1, vector.length); + assertEquals(2, vector.length); assertEquals(1f, vector[0], 0f); + assertEquals(2f, vector[1], 0f); assertEquals(1, floatVectors.nextDoc()); vector = floatVectors.vectorValue(); - assertEquals(1, vector.length); + assertEquals(2, vector.length); assertEquals(1f, vector[0], 0f); + assertEquals(2f, vector[1], 0f); assertEquals(DocIdSetIterator.NO_MORE_DOCS, floatVectors.nextDoc()); IOUtils.close(reader, w2, dir1, dir2);