carlosdelest commented on code in PR #14274:
URL: https://github.com/apache/lucene/pull/14274#discussion_r1993167987


##########
lucene/core/src/test/org/apache/lucene/search/BaseKnnVectorQueryTestCase.java:
##########
@@ -646,6 +654,24 @@ public void testRandomWithFilter() throws IOException {
                   searcher.search(
                       getThrowingKnnVectorQuery("field", 
randomVector(dimension), 1, filter4),
                       numDocs));
+
+          // Test a filter with cost slightly more than k, and check we use 
exact search as k
+          // results are not retrieved from approximate search
+          Query filter5 = IntPoint.newRangeQuery("tag", lower, lower + 11);
+          results =
+              searcher.search(
+                  getKnnVectorQuery("field", randomVector(dimension), 10, 
filter5), numDocs);
+          assertEquals(10, results.totalHits.value());
+          assertEquals(results.totalHits.value(), results.scoreDocs.length);
+          expectThrows(
+              UnsupportedOperationException.class,
+              () ->
+                  searcher.search(
+                      getCappedResultsThrowingKnnVectorQuery(
+                          "field", randomVector(dimension), 10, filter5, 5),
+                      numDocs));
+          assertEquals(10, results.totalHits.value());
+          assertEquals(results.totalHits.value(), results.scoreDocs.length);

Review Comment:
   I did! I checked all the subclasses with 5K iterations multiple times.
   
   The test is forcing a number of results to be returned via the capped 
results query, so it will always return a number of results that will result in 
doing an exact query. Why do you think it will be flaky?



-- 
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