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

 ##########
 File path: 
lucene/core/src/java/org/apache/lucene/search/TopScoreDocCollector.java
 ##########
 @@ -207,16 +210,23 @@ public static TopScoreDocCollector create(int numHits, 
ScoreDoc after, int total
     }
   }
 
-  final int totalHitsThreshold;
   ScoreDoc pqTop;
+  final HitsThresholdChecker hitsThresholdChecker;
 
   // prevents instantiation
-  TopScoreDocCollector(int numHits, int totalHitsThreshold) {
+  TopScoreDocCollector(int numHits, int totalHitsThreshold, 
HitsThresholdChecker hitsThresholdChecker) {
     super(new HitQueue(numHits, true));
-    this.totalHitsThreshold = totalHitsThreshold;
+    assert hitsThresholdChecker != null;
+
     // HitQueue implements getSentinelObject to return a ScoreDoc, so we know
     // that at this point top() is already initialized.
     pqTop = pq.top();
+    this.hitsThresholdChecker = hitsThresholdChecker;
+  }
+
+  // Same as above but uses a local hits checker for hits threshold checks
+  TopScoreDocCollector(int numHits, int totalHitsThreshold) {
 
 Review comment:
   Same as `TopFieldCollector`, we should have a single constructor that takes 
a `HitsThresholdChecker` and build the `totalHitsThreshold` logic in the static 
function.

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