mayya-sharipova commented on a change in pull request #616:
URL: https://github.com/apache/lucene/pull/616#discussion_r792529671



##########
File path: 
lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBackwardsCompatibility.java
##########
@@ -1325,22 +1382,44 @@ public void changeIndexWithAdds(Random random, 
Directory dir, Version nameVersio
 
     reader = DirectoryReader.open(dir);
     searcher = newSearcher(reader);
+    // make sure searching sees right # hits fot term search
     hits = searcher.search(new TermQuery(new Term("content", "aaa")), 
1000).scoreDocs;
     assertEquals("wrong number of hits", 44, hits.length);
     d = searcher.doc(hits[0].doc);
     doTestHits(hits, 44, searcher.getIndexReader());
     assertEquals("wrong first document", "0", d.get("id"));
+
+    // make sure searching sees right # hits for KNN search
+    if (nameVersion.major >= KNN_VECTOR_MIN_SUPPORTED_VERSION) {
+      float[] queryVector = {0.1f, 0.1f, 0.1f};
+      hits =
+          searcher.search(new KnnVectorQuery(KNN_VECTOR_FIELD, queryVector, 
1000), 1000).scoreDocs;

Review comment:
       That's a good comment, I've added an extra test for k =10.
   
   But I also kept this test with a high k. Similar to a term query before 
that, I think using high `k`  or  high`n`  was meant to make sure that search 
sees all the documents in the index including the newly added ones. 




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to