kaivalnp commented on code in PR #13285: URL: https://github.com/apache/lucene/pull/13285#discussion_r1599151876
########## lucene/core/src/java/org/apache/lucene/search/AbstractVectorSimilarityQuery.java: ########## @@ -144,22 +158,22 @@ protected boolean match(int doc) { } // Perform an approximate search - TopDocs results = approximateSearch(context, acceptDocs, cardinality); + TopDocs results = + approximateSearch(context, acceptDocs, cardinality, timeLimitingKnnCollectorManager); - // If the limit was exhausted - if (results.totalHits.relation == TotalHits.Relation.GREATER_THAN_OR_EQUAL_TO) { + if (results.totalHits.relation == TotalHits.Relation.EQUAL_TO + // Return partial results only when timeout is met + || (queryTimeout != null && queryTimeout.shouldExit())) { + // Return an iterator over the collected results + return VectorSimilarityScorer.fromScoreDocs(this, boost, results.scoreDocs); + } else { // Return a lazy-loading iterator return VectorSimilarityScorer.fromAcceptDocs( this, boost, createVectorScorer(context), new BitSetIterator(acceptDocs, cardinality), resultSimilarity); - } else if (results.scoreDocs.length == 0) { - return null; Review Comment: Yes, it was common in a couple of places so I moved it there to reduce repetition -- 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