Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Sort at the query time #305

Closed
6 tasks
curquiza opened this issue Aug 13, 2021 · 0 comments · Fixed by #309
Closed
6 tasks

Sort at the query time #305

curquiza opened this issue Aug 13, 2021 · 0 comments · Fixed by #309
Assignees
Labels
tracking issue Tracks developpement of a new feature

Comments

@curquiza
Copy link
Member

curquiza commented Aug 13, 2021

Important


Feature purpose

The sort feature introduces the possibility to quickly sort the search results as an end-user during the search time.

TODO

  • The core engine should support the sort on String in lexicographic order. If the dataset contains values in String and number for the same field, the search engine first sorts the numbers and then the strings.
    asc/desc should now work on strings with the same behavior

  • Add the sort ranking rule at the third position by default. It means the core-engine will apply the sort after the ranking rules words and typo. If the end-user does not request any search at the query time, the ranking rule sort is ignored.
    The sort ranking rule can be removed or set at a different place in the rankingRules setting, so that the users can adjust their relevancy.

  • Add sort query/request parameter during search time. It supports strings and numbers. Strings can be sorted in lexicographical order.
    The end-users must indicate the order of the expected sort (asc/desc). Multiple fields can be passed to be sorted:
    ex: ["price:asc", "author:desc"]
    The error message when the end-users try to sort on an attributes non-declared as sortableAttributes:

Attribute `title` is not sortable, available sortable attributes are: ..., ...
  • The search engine needs to know what are the attributes to sort via sortableAttributes settings.
    The behavior of this setting is similar to filterableAttributes: the default value is [] and the core engine expects an array of strings. If an unknown field is passed to sortableAttributes, no error is raised.
    Refer to the spec for more details and the error behaviors.

  • New syntax for the custom ranking rules: desc(X) becomes X:desc and asc(Y) becomes Y:asc. This syntax is also available for sorting during query time.

  • Add tests for the sort relevancy

@curquiza curquiza added the tracking issue Tracks developpement of a new feature label Aug 13, 2021
@curquiza curquiza added tracking issue Tracks developpement of a new feature and removed tracking issue Tracks developpement of a new feature labels Aug 13, 2021
@bors bors bot closed this as completed in 41fc0dc Aug 18, 2021
@bors bors bot closed this as completed in #309 Aug 18, 2021
bors bot added a commit that referenced this issue Aug 24, 2021
320: Sort at query time r=Kerollmops a=Kerollmops

Re-introduce the Sort at the query time (#305)

Co-authored-by: Clément Renault <renault.cle@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
tracking issue Tracks developpement of a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants