javanna commented on code in PR #16042:
URL: https://github.com/apache/lucene/pull/16042#discussion_r3207521443


##########
lucene/core/src/java/org/apache/lucene/search/TopFieldCollectorManager.java:
##########
@@ -182,6 +186,16 @@ public TopFieldDocs reduce(Collection<TopFieldCollector> 
collectors) throws IOEx
     return TopDocs.merge(sort, 0, numHits, topDocs);
   }
 
+  /**
+   * Returns the collectors created by this manager.
+   *
+   * @deprecated This method and internal collector tracking will be removed 
in Lucene 11. The
+   *     internal collector tracking is unnecessary since collectors are 
passed to {@link
+   *     #reduce(Collection)} by {@link IndexSearcher}. Users who need to 
track collectors (e.g.,
+   *     for early termination detection via {@link 
TopFieldCollector#isEarlyTerminated()}) should
+   *     maintain their own collection.

Review Comment:
   I would try to shorten this comment and make the point that all the needed 
info is returned as part of the result of reduction, in this case a 
`TopFieldDocs` instance. Checking for early termination is best done by 
checking the total hits relation like `TopFieldCollector#isEarlyTerminated` 
does for its part of the execution (to be honest, I am not even sure if we 
should be specific about this - I am not sure what the usecase is of checking 
if each collector is early terminated - up to you).



##########
lucene/CHANGES.txt:
##########
@@ -23,6 +23,10 @@ API Changes
 * GITHUB#15584: Add support for termdoc fields that use custom term freqs (via 
IndexOptions.DOCS_AND_CUSTOM_FREQS).
   IndexWriter counts their terms rather than summing their freqs.  Use
 
+* GITHUB#15605: Deprecate getCollectors() in TopFieldCollectorManager. The 
internal collector
+  tracking is unnecessary and will be removed in Lucene 11. Clarify 
thread-safety

Review Comment:
   here too, I would rather say something like:
   
   > Deprecate TopFieldCollectorManager#getCollectors . The result of the 
search operation is returned as part of a `TopFieldDocs` instance, there is no 
need to check the state of each collector after search
   
   
   Feel free to reword it as needed, it is just an example.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to