SOLR-17310: Configurable LeafSorter to customize segment search order
https://issues.apache.org/jira/browse/SOLR-17310
Description
Lucene's IndexWriterConfig provides the option to sort leaf readers when a custom LeafSorter is provided. The functionality is currently not directly exposed in Solr. There are cases where we would like to customize the segment visit order, for example, visit the recently updated segments first when early termination is applied.
Solution
The SegmentTimeLeafSorter sorts the LeafReaders by time stamp, in ascending or descending order. It can be enabled by adding the segmentSort config in solrconfig.xml. Without the config, no sorting is applied by default.
Tests
Added unit test and verified all tests pass.
Checklist
Please review the following and check all that apply:
- [X] I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
- [X] I have created a Jira issue and added the issue ID to my pull request title.
- [X] I have given Solr maintainers access to contribute to my PR branch. (optional but recommended)
- [X] I have developed this patch against the
mainbranch. - [X] I have run
./gradlew check. - [X] I have added tests for my changes.
- [X] I have added documentation for the Reference Guide
Tagging @cpoerschke for review; I figure you're a better reviewer here. I haven't used this aspect of Lucene before.
This PR has had no activity for 60 days and is now labeled as stale. Any new activity or converting it to draft will remove the stale label. To attract more reviewers, please tag people who might be familiar with the code area and/or notify the [email protected] mailing list. Thank you for your contribution!
This PR has had no activity for 60 days and is now labeled as stale. Any new activity will remove the stale label. To attract more reviewers, please tag people who might be familiar with the code area and/or notify the [email protected] mailing list. To exempt this PR from being marked as stale, make it a draft PR or add the label "exempt-stale". If left unattended, this PR will be closed after another 60 days of inactivity. Thank you for your contribution!
This PR is now closed due to 60 days of inactivity after being marked as stale. Re-opening this PR is still possible, in which case it will be marked as active again.
keep it open
Seems like this ticket and https://github.com/apache/solr/pull/313 both have stalled out... Thoughts on a thread on the dev mailing list to see if we think moving forward with this or the #313 approach gets us moving?
Thanks for bringing this up. Would definitely like to have a discussion about moving this forward.
Thanks, Wei
On Sun, Feb 2, 2025 at 5:20 AM Eric Pugh @.***> wrote:
Seems like this ticket and #313 https://github.com/apache/solr/pull/313 both have stalled out... Thoughts on a thread on the dev mailing list to see if we think moving forward with this or the #313 https://github.com/apache/solr/pull/313 approach gets us moving?
— Reply to this email directly, view it on GitHub https://github.com/apache/solr/pull/2477#issuecomment-2629393983, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHFRMAHANN5EOQ377KR34FD2NYLQ5AVCNFSM6AAAAABIG2LSHCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMRZGM4TGOJYGM . You are receiving this because you authored the thread.Message ID: @.***>