serhiy-bzhezytskyy opened a new pull request, #4647: URL: https://github.com/apache/solr/pull/4647
https://issues.apache.org/jira/browse/SOLR-15390 # Description `segmentTerminateEarly=true` lets Solr stop collecting a segment once enough docs are gathered when the index sort matches the query sort. Today that path uses Lucene's `EarlyTerminatingSortingCollector`, which has been **deprecated in Lucene** and is slated for removal. As Tomas noted on the JIRA, `TopFieldCollector` already does this — and does it more efficiently, since it tracks hits across segments rather than per-segment. This PR switches `segmentTerminateEarly` to native `TopFieldCollector` early termination and removes the deprecated collector. (Tomas — SOLR-15390's reporter — wrote "Feel free to take it" on the issue, and the earlier PR #114 was auto-closed as stale rather than rejected, so I picked it up.) # Solution - `buildAndRunCollectorChain` now inspects the `TopFieldCollector` after the search instead of wrapping the search in `EarlyTerminatingSortingCollector`. - `buildTopDocsCollector` lowers the total-hits threshold to the page size on the `segmentTerminateEarly` path so termination can fire. - The `segmentTerminatedEarly` response header is reported exactly as before: absent when not requested, `false` when the sort / merge-policy combination isn't eligible, `true` when a segment terminated early. - The deprecated `EarlyTerminatingSortingCollector` is removed. # Tests - `TestSegmentSorting` (incl. `testSegmentTerminateEarly`, `testAtomicUpdateOfSegmentSortField`) — pass. - `TestEarlyTerminatingQueries` — pass. # Checklist - [x] I have created a JIRA issue (SOLR-15390) — reusing the existing one. - [x] I have developed this on the `main` branch. - [x] I have run `./gradlew check`-relevant tests for the touched area. - [x] I have added tests / the existing tests cover the change. -- 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]
