mikemccand commented on a change in pull request #579: PET: prorated early
termination
URL: https://github.com/apache/lucene-solr/pull/579#discussion_r258158151
##########
File path: lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java
##########
@@ -525,25 +517,8 @@ private TopFieldDocs searchAfter(FieldDoc after, Query
query, int numHits, Sort
final int cappedNumHits = Math.min(numHits, limit);
final Sort rewrittenSort = sort.rewrite(this);
- final CollectorManager<TopFieldCollector, TopFieldDocs> manager = new
CollectorManager<TopFieldCollector, TopFieldDocs>() {
-
- @Override
- public TopFieldCollector newCollector() throws IOException {
- // TODO: don't pay the price for accurate hit counts by default
- return TopFieldCollector.create(rewrittenSort, cappedNumHits, after,
TOTAL_HITS_THRESHOLD);
- }
-
- @Override
- public TopFieldDocs reduce(Collection<TopFieldCollector> collectors)
throws IOException {
- final TopFieldDocs[] topDocs = new TopFieldDocs[collectors.size()];
- int i = 0;
- for (TopFieldCollector collector : collectors) {
- topDocs[i++] = collector.topDocs();
- }
- return TopDocs.merge(rewrittenSort, 0, cappedNumHits, topDocs, true);
- }
-
- };
+ final CollectorManager<TopFieldCollector, TopFieldDocs> manager =
+ TopFieldCollector.createManager(rewrittenSort, cappedNumHits, after,
TOTAL_HITS_THRESHOLD, Integer.MAX_VALUE);
Review comment:
Was this just a straight refactor? The new way does the same thing as the
old anonymous class?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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]