You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "romseygeek (via GitHub)" <gi...@apache.org> on 2026/10/16 16:08:37 UTC
[PR] Consolidate Sort pruning logic [lucene]
romseygeek opened a new pull request, #16857:
URL: https://github.com/apache/lucene/pull/16857
Whether or not to use index-sort based early termination or index-value based sort pruning is currently scattered around several different classes at both index and segment level, making it difficult to add further optimizations. This change consolidates these decisions into segment-level logic centred on FieldValueHitQueue, with value-based pruning handled via getLeafComparator and index-sort-based pruning handled in a new comparator class, IndexSortedLeafFieldComparator.
In addition, the deprecated methods on SortField that allow users to disable pruning are removed and replaced by a new wrapper class. This has the advantage of removing one more mutable field from SortField, and also makes it clear that it only applies to search-time sorts.
This will allow future improvements around individual segment-based sorts - for example, we will be able to make use of the effective primary sort field optimizations that detect whether or not leading sort fields are no-ops on individual segments.
--
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: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Consolidate Sort pruning logic [lucene]
Posted by "romseygeek (via GitHub)" <gi...@apache.org>.
romseygeek commented on PR #16857:
URL: https://github.com/apache/lucene/pull/16857#issuecomment-6219667660
I ran benchmarks for this change and they showed no significant difference. This is mainly about making future changes easier:
```
┌───────────────────────────────────────────┬─────────────────┬─────────────────┬────────────────────────┬─────────┐
│ Task │ Baseline QPS │ Candidate QPS │ Change │ p-value │
├───────────────────────────────────────────┼─────────────────┼─────────────────┼────────────────────────┼─────────┤
│ HighTermDayOfYearSort (sort = index sort) │ 741.13 (±38.3%) │ 746.48 (±34.7%) │ +0.7% (−52% to +119%) │ 0.965 │
├───────────────────────────────────────────┼─────────────────┼─────────────────┼────────────────────────┼─────────┤
│ HighTermMonthSort (sort ≠ index sort) │ 556.61 (±32.9%) │ 636.43 (±39.2%) │ +14.3% (−43% to +129%) │ 0.376 │
├───────────────────────────────────────────┼─────────────────┼─────────────────┼────────────────────────┼─────────┤
│ PKLookup (control, no sort) │ 297.00 (±37.7%) │ 262.50 (±31.3%) │ −11.6% (−58% to +92%) │ 0.453 │
└───────────────────────────────────────────┴─────────────────┴─────────────────┴────────────────────────┴─────────┘
```
--
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: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org