apache / apache/lucene

search APIs should take advantage of index sort by default [LUCENE-7282]

Open
#8,337 7 comments 0 reactions 0 assignees View on GitHub
legacy-jira-priority:Major type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

Spinoff from #7824, where we made it very easy to have Lucene sort documents in the index (at merge time).

An index-time sort is powerful because if you then search that index by the same sort (or by a "prefix" of it), you can early-terminate per segment once you've collected enough hits. But doing this by default would mean accepting an approximate hit count, and could not be used in cases that need to see every hit, e.g. if you are also faceting.

Separately, `TermQuery` on the leading sort field can be very fast since we can advance to the first docID, and only match to the last docID for the requested value. This would not be approximate, and should be lower risk / easier.

---
Migrated from [LUCENE-7282](https://issues.apache.org/jira/browse/LUCENE-7282) by Michael McCandless (@mikemccand), updated Feb 02 2022

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.