You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2022/02/04 19:43:34 UTC
[lucene] branch main updated: LUCENE-9573 Add Vectors to TestBackwardsCompatibility (#636)
This is an automated email from the ASF dual-hosted git repository.
mayya 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 ea4ab26 LUCENE-9573 Add Vectors to TestBackwardsCompatibility (#636)
ea4ab26 is described below
commit ea4ab26e52001a142124c51ef9dd9fdee0ed3371
Author: Mayya Sharipova <ma...@elastic.co>
AuthorDate: Wed Feb 2 14:25:59 2022 -0500
LUCENE-9573 Add Vectors to TestBackwardsCompatibility (#636)
Update index.9.0.0-cfs.zip and index.9.0.0-nocfs.zip
to include knn vector field.
---
.../backward_index/TestBackwardsCompatibility.java | 18 ++++++++++--------
.../lucene/backward_index/index.9.0.0-cfs.zip | Bin 16683 -> 17621 bytes
.../lucene/backward_index/index.9.0.0-nocfs.zip | Bin 16669 -> 17627 bytes
3 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBackwardsCompatibility.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBackwardsCompatibility.java
index ceb2029..83480a9 100644
--- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBackwardsCompatibility.java
+++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBackwardsCompatibility.java
@@ -17,7 +17,7 @@
package org.apache.lucene.backward_index;
import static org.apache.lucene.search.DocIdSetIterator.NO_MORE_DOCS;
-import static org.apache.lucene.util.Version.LUCENE_10_0_0;
+import static org.apache.lucene.util.Version.LUCENE_9_0_0;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -163,8 +163,7 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
private static final int DOCS_COUNT = 35;
private static final int DELETED_ID = 7;
- // change version to 9 when we update 9 backward indices to include KNN field
- private static final int KNN_VECTOR_MIN_SUPPORTED_VERSION = LUCENE_10_0_0.major;
+ private static final int KNN_VECTOR_MIN_SUPPORTED_VERSION = LUCENE_9_0_0.major;
private static final String KNN_VECTOR_FIELD = "knn_field";
private static final FieldType KNN_VECTOR_FIELD_TYPE =
KnnVectorField.createFieldType(3, VectorSimilarityFunction.COSINE);
@@ -1038,9 +1037,10 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
}
}
- public void testSearchOldIndex() throws IOException {
+ public void testSearchOldIndex() throws Exception {
for (String name : oldNames) {
- searchIndex(oldIndexDirs.get(name), name, Version.MIN_SUPPORTED_MAJOR);
+ Version version = Version.parse(name.substring(0, name.indexOf('-')));
+ searchIndex(oldIndexDirs.get(name), name, Version.MIN_SUPPORTED_MAJOR, version);
}
if (TEST_NIGHTLY) {
@@ -1048,7 +1048,8 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
Path oldIndexDir = createTempDir(name);
TestUtil.unzip(getDataInputStream("unsupported." + name + ".zip"), oldIndexDir);
try (BaseDirectoryWrapper dir = newFSDirectory(oldIndexDir)) {
- searchIndex(dir, name, MIN_BINARY_SUPPORTED_MAJOR);
+ Version version = Version.parse(name.substring(0, name.indexOf('-')));
+ searchIndex(dir, name, MIN_BINARY_SUPPORTED_MAJOR, version);
}
}
}
@@ -1085,7 +1086,8 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
}
}
- public void searchIndex(Directory dir, String oldName, int minIndexMajorVersion)
+ public void searchIndex(
+ Directory dir, String oldName, int minIndexMajorVersion, Version nameVersion)
throws IOException {
// QueryParser parser = new QueryParser("contents", new MockAnalyzer(random));
// Query query = parser.parse("handle:1");
@@ -1296,7 +1298,7 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
searcher.getIndexReader());
// test vector values and KNN search
- if (minIndexMajorVersion >= KNN_VECTOR_MIN_SUPPORTED_VERSION) {
+ if (nameVersion.major >= KNN_VECTOR_MIN_SUPPORTED_VERSION) {
// test vector values
int cnt = 0;
for (LeafReaderContext ctx : reader.leaves()) {
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/index.9.0.0-cfs.zip b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/index.9.0.0-cfs.zip
index 2783c4b..71a6557 100644
Binary files a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/index.9.0.0-cfs.zip and b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/index.9.0.0-cfs.zip differ
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/index.9.0.0-nocfs.zip b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/index.9.0.0-nocfs.zip
index 98dfb5f..75926c9 100644
Binary files a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/index.9.0.0-nocfs.zip and b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/index.9.0.0-nocfs.zip differ