mocobeta commented on code in PR #833:
URL: https://github.com/apache/lucene/pull/833#discussion_r863840972


##########
lucene/core/src/test/org/apache/lucene/index/TestExitableDirectoryReader.java:
##########
@@ -428,6 +430,107 @@ public void testDocValues() throws IOException {
     directory.close();
   }
 
+  public void testVectorValues() throws IOException {
+    Directory directory = newDirectory();
+    IndexWriter writer =
+        new IndexWriter(directory, newIndexWriterConfig(new 
MockAnalyzer(random())));
+
+    int numDoc = atLeast(20);
+    int deletedDoc = atMost(5);
+    int dimension = atLeast(3);
+    boolean vectorIndexed = false;
+
+    for (int i = 0; i < numDoc; i++) {
+      Document doc = new Document();
+
+      if (random().nextBoolean()) {
+        vectorIndexed = true;
+        float[] value = new float[dimension];
+        for (int j = 0; j < dimension; j++) {
+          value[j] = random().nextFloat();
+        }
+        FieldType fieldType =
+            KnnVectorField.createFieldType(dimension, 
VectorSimilarityFunction.COSINE);
+        doc.add(new KnnVectorField("vector", value, fieldType));
+      }
+
+      doc.add(new StringField("id", Integer.toString(i), Field.Store.YES));
+      writer.addDocument(doc);
+    }
+
+    writer.forceMerge(1);
+    writer.commit();
+
+    for (int i = 0; i < deletedDoc; i++) {
+      writer.deleteDocuments(new Term("id", Integer.toString(i)));
+    }
+
+    writer.close();
+
+    QueryTimeout randomQueryTimeout;

Review Comment:
   Or, I guess we can test all three timeout patterns in this test without 
randomness, like `testExitableFilterTermsIndexReader()`? Sorry if I'm missing 
any points.



-- 
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: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to