msokolov commented on code in PR #16798:
URL: https://github.com/apache/lucene/pull/16798#discussion_r4229769511


##########
lucene/core/src/java/org/apache/lucene/search/CollectorManager.java:
##########
@@ -53,4 +53,18 @@ public interface CollectorManager<C extends Collector, T> {
    * called after collection is finished on all provided collectors.
    */
   T reduce(Collection<C> collectors) throws IOException;
+
+  static CollectorManager<?, Void> singleton(Collector collector) {
+    return new CollectorManager<>() {
+      @Override
+      public Collector newCollector() {
+        return collector;

Review Comment:
   RIght, I guess this was naiive. It doesn't work, as you pointed out. Making 
this code re-entrant will require some substantial refactoring. Especially the 
collector that collects terms *with their scores* will require some new data 
structure and it will need to merge results across multiple threads in reduce. 



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