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_r318561896
########## File path: lucene/core/src/java/org/apache/lucene/search/TopFieldCollector.java ########## @@ -96,16 +96,21 @@ private static boolean canEarlyTerminateOnPrefix(Sort searchSort, Sort indexSort * document scores and maxScore. */ private static class SimpleFieldCollector extends TopFieldCollector { - final Sort sort; final FieldValueHitQueue<Entry> queue; - public SimpleFieldCollector(Sort sort, FieldValueHitQueue<Entry> queue, int numHits, int totalHitsThreshold) { - super(queue, numHits, totalHitsThreshold, sort.needsScores()); + public SimpleFieldCollector(Sort sort, FieldValueHitQueue<Entry> queue, int numHits, int totalHitsThreshold, + HitsThresholdChecker hitsThresholdChecker) { + super(queue, numHits, totalHitsThreshold, hitsThresholdChecker, sort.needsScores()); this.sort = sort; this.queue = queue; } + /* Default case -- Single threaded execution */ + public SimpleFieldCollector(Sort sort, FieldValueHitQueue<Entry> queue, int numHits, int totalHitsThreshold) { Review comment: Could we replace this ctr with a static function that calls `TopFieldCollector#create` with the appropriate `LocalHitsThresholdChecker`? This way we don't need to reimplement the logic to create `SimpleFieldCollector` or `PagingCollector` twice, e.g.: ```` public static TopFieldCollector create(Sort sort, int numHits, FieldDoc after, int totalHitsThreshold) { if (totalHitsThreshold < 0) { throw new IllegalArgumentException("totalHitsThreshold must be >= 0, got " + totalHitsThreshold); } return create(sort, numHits, new LocalHitsThresholdChecker(totalHitsThreshold)); } ````` ---------------------------------------------------------------- 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