atris commented on a change in pull request #823: LUCENE-8939: Introduce Shared 
Count Early Termination In Parallel Search
URL: https://github.com/apache/lucene-solr/pull/823#discussion_r320343227
 
 

 ##########
 File path: lucene/core/src/java/org/apache/lucene/search/TopFieldCollector.java
 ##########
 @@ -410,10 +423,34 @@ public static TopFieldCollector create(Sort sort, int 
numHits, FieldDoc after,
         throw new IllegalArgumentException("after.fields has " + 
after.fields.length + " values but sort has " + sort.getSort().length);
       }
 
-      return new PagingFieldCollector(sort, queue, after, numHits, 
totalHitsThreshold);
+      return new PagingFieldCollector(sort, queue, after, numHits, 
hitsThresholdChecker);
     }
   }
 
+  /**
+   * Create a CollectorManager which uses a shared hit counter to maintain 
number of hits
+   */
+  public static CollectorManager<TopFieldCollector, TopFieldDocs> 
createSharedManager(Sort sort, int numHits, FieldDoc after,
+                                                                               
  int totalHitsThreshold) {
+    return new CollectorManager<>() {
+
+      @Override
+      public TopFieldCollector newCollector() throws IOException {
+        return create(sort, numHits, after, 
HitsThresholdChecker.createShared(totalHitsThreshold));
 
 Review comment:
   Yeah, rebasing error, thanks for highlighting -- fixed

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to