jpountz commented on PR #964: URL: https://github.com/apache/lucene/pull/964#issuecomment-1161979978
I reverted changes to top-docs collectors. This means this new `Collector#setWeight` API is only useful to `TotalHitCountCollector`. I've been wondering if it was worth adding a new API only for `TotalHitCountCollector` but looking at how facets use this collector, I suspect that many users set up their collectors manually instead of using `IndexSearcher#count` and do not benefit from this optimization, so maybe it's worth the increased API surface. I was chatting about the API with @romseygeek, and we wondered if having the counting logic on `Scorable` would help. I looked into it, and it's not super practical due to the fact that `LeafCollector#setScorer` is not a place where throwing a `CollectorTerminatedException` is supported now (though this could be addressed) and this method can be called multiple times per segment, so we would need to introduce tracking to make sure that we only increment the count on the first time that `setScorer` is called on a segment. For these reasons, I would prefer moving forward with the current API on `Collector`. -- 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]
