jpountz 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_r320004644
##########
File path: lucene/core/src/java/org/apache/lucene/search/TopFieldCollector.java
##########
@@ -382,8 +383,19 @@ public static TopFieldCollector create(Sort sort, int
numHits, int totalHitsThre
* @return a {@link TopFieldCollector} instance which will sort the results
by
* the sort criteria.
*/
+ 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, after,
HitsThresholdChecker.create(totalHitsThreshold));
+ }
+
+ /**
+ * Same as above with an additional parameter to allow passing in the
threshold checker
+ */
public static TopFieldCollector create(Sort sort, int numHits, FieldDoc
after,
- int totalHitsThreshold) {
+ HitsThresholdChecker
hitsThresholdChecker) {
Review comment:
I'd have a preference for not exposing `HitsThresholdChecker` in the
user-facing API and instead providing users with a factory method for a
collector manager that can be used with multiple threads, e.g. `public static
CollectorManager<TopFieldCollector, TopDocs> createSharedManager(sort, numHits,
after, 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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]