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