mirror of https://github.com/apache/lucene.git
Speed up sorting on unique string fields. (#11903)
Since increasing the number of hits retrieved in nightly benchmarks from 10 to 100, the performance of sorting documents by title dropped back to the level it had before introducing dynamic pruning. This is not too surprising given that the `title` field is a unique field, so the optimization would only kick in when the current 100th hit would have an ordinal that is less than 128 - something that would only happen after collecting most hits. This change increases the threshold to 1024, so that the optimization would kick in when the current 100th hit has an ordinal that is less than 1024, something that happens a bit sooner.
This commit is contained in:
parent
4b3f7662ce
commit
5b87a31556
|
@ -253,6 +253,8 @@ Optimizations
|
||||||
* GITHUB#12719: Top-level conjunctions that are not sorted by score now have a
|
* GITHUB#12719: Top-level conjunctions that are not sorted by score now have a
|
||||||
specialized bulk scorer. (Adrien Grand)
|
specialized bulk scorer. (Adrien Grand)
|
||||||
|
|
||||||
|
* GITHUB#11903: Faster sort on high-cardinality string fields. (Adrien Grand)
|
||||||
|
|
||||||
Changes in runtime behavior
|
Changes in runtime behavior
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
|
|
|
@ -475,7 +475,7 @@ public class TermOrdValComparator extends FieldComparator<BytesRef> {
|
||||||
|
|
||||||
private class CompetitiveIterator extends DocIdSetIterator {
|
private class CompetitiveIterator extends DocIdSetIterator {
|
||||||
|
|
||||||
private static final int MAX_TERMS = 128;
|
private static final int MAX_TERMS = 1024;
|
||||||
|
|
||||||
private final LeafReaderContext context;
|
private final LeafReaderContext context;
|
||||||
private final int maxDoc;
|
private final int maxDoc;
|
||||||
|
|
Loading…
Reference in New Issue