mayya-sharipova commented on code in PR #12794: URL: https://github.com/apache/lucene/pull/12794#discussion_r1403560016
########## lucene/core/src/java/org/apache/lucene/search/AbstractKnnVectorQuery.java: ########## @@ -79,24 +81,30 @@ public Query rewrite(IndexSearcher indexSearcher) throws IOException { filterWeight = null; } + MaxScoreAccumulator globalMinSimAcc = new MaxScoreAccumulator(); TaskExecutor taskExecutor = indexSearcher.getTaskExecutor(); List<LeafReaderContext> leafReaderContexts = reader.leaves(); List<Callable<TopDocs>> tasks = new ArrayList<>(leafReaderContexts.size()); for (LeafReaderContext context : leafReaderContexts) { - tasks.add(() -> searchLeaf(context, filterWeight)); + tasks.add(() -> searchLeaf(context, filterWeight, globalMinSimAcc)); Review Comment: `MaxScoreAccumulator` is thread safe, it uses `LongAccumulator` that is enough for our purposes to collect max global similarity. And the same instance of `MaxScoreAccumulator` is shared among all slices. This approach is similar to `TopScoreDocCollector`. -- 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