TotalHitCountCollector to stop counting when threshold is reached
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
### Description
`TopScoreDocCollector` stops collecting hits as well as counting total hits when the provided total hits threshold is reached. Would it make sense to introduce a similar mechanism to `TotalHitCountCollector` so that you can provide a `numHitsThreshold` at initialization time and it will stop counting total hits as soon as the threshold is reached? This is consistent to the behaviour when collecting hits, in case users are not interested in accurate hit counts, and can make collection faster in that case: why keep counting if we have already counted enough hits?
This is something that Elasticsearch supports today by wrapping the total hit count collector with a collector that does early termination. I thought it's simple enough and convenient to have such a mechanism built-in in Lucene, and without requiring to wrap the collector.
Contributor guide
Assessment
This issue has not been assessed yet.