Skip to content

Commit

Permalink
Test fix: make float vector dims even for SQ testing
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisHegarty committed Sep 20, 2024
1 parent 73d71ac commit 53d1c2b
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1817,7 +1817,7 @@ public void testMismatchedFields() throws Exception {
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);

Expand Down Expand Up @@ -1849,12 +1849,14 @@ public void testMismatchedFields() throws Exception {
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);
Expand Down

0 comments on commit 53d1c2b

Please sign in to comment.