Skip to content

Smarter use of sort-field optimizations in DV range queries - #16424

Open
romseygeek wants to merge 3 commits into
apache:mainfrom
romseygeek:sort/get-primary-sortfield
Open

Smarter use of sort-field optimizations in DV range queries#16424
romseygeek wants to merge 3 commits into
apache:mainfrom
romseygeek:sort/get-primary-sortfield

Conversation

@romseygeek

Copy link
Copy Markdown
Contributor

When the primary sort field on a segment contains no values or only a single value, then it is effectively a no-op and range queries against the secondary sort field can make use of the sort-field optimizations usually reserved for queries against the primary.

This adds a helper method, Sort.getPrimarySortField(LeafReader), that tries to identify no-op primary sort fields using index-level stats from FieldInfo or associated DocValuesSkipper entries, and uses it in the various XDocValuesRangeQuery implementations.

When the primary sort field on a segment contains no values or only a
single value, then it is effectively a no-op and range queries against
the secondary sort field can make use of the sort-field optimizations
usually reserved for queries against the primary.

This adds a helper method, Sort.getPrimarySortField(LeafReader), that
tries to identify no-op primary sort fields using index-level stats
from FieldInfo or associated DocValuesSkipper entries, and uses it
in the various XDocValuesRangeQuery implementations.
@romseygeek

Copy link
Copy Markdown
Contributor Author

We can also use this in TopFieldCollector, but that's slightly more complex so I'd like to leave it for a follow-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant