Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Elasticsearch] if in pattern matcher mode, treat default sort like it's _score: DESC #264

Open
dkarlovi opened this issue Feb 13, 2019 · 0 comments
Milestone

Comments

@dkarlovi
Copy link
Contributor

Description

Elasticsearch does sorting by creating an implicit property called _score. It allows documents to "contribute to the score" and then the quality of the results is determined by sorting by _score DESC.

This means default sort values should be appended to that sort if we're doing a fuzzy search since the quality of the document's match is directly reflected in its score, sorting by anything else decreases the quality.

Example

If we have default sort @created_at: DESC, searching is_active: true should give active entities sorted by created_at property.

But, searching by title: ~*paris should sort by how well the entity matches the query paris (which means we don't want the newest entity to be first, we want the best match to be first). If the final query would have been title: ~*paris; @_score: ASC; @created_at: DESC, then it works as expected.

Related to #263. Somewhat related to #258.

@sstok sstok added this to the 2.0 milestone Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants