-
Notifications
You must be signed in to change notification settings - Fork 368
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
cannot have more than 1 script sorting #795
Comments
Hey @jiajiawang 👋 ! |
Hey @rabotyaga, Yes, I'm interested in it. |
Hey @jiajiawang 👋 !
Great! And thanks!
Yep, I believe we should change the |
To allow multiple sorting options that may have the same key name. For example script based sorting whose key will always be `_script`.
Use Array to store the value of Chewy::Search::Parameters::Order. To allow multiple sorting options that may have the same key name. For example script based sorting whose key will always be `_script`.
Use Array to store the value of Chewy::Search::Parameters::Order. To allow multiple sorting options that may have the same key name. For example script based sorting whose key will always be `_script`.
Use Array to store the value of Chewy::Search::Parameters::Order. To allow multiple sorting options that may have the same key name. For example script based sorting whose key will always be `_script`.
* [Fix toptal#795] **(Breaking)** Change implementation of Order param Use Array to store the value of Chewy::Search::Parameters::Order. To allow multiple sorting options that may have the same key name. For example script based sorting whose key will always be `_script`.
In elasticsearch, you can have as many script sorting as you want.
For example, there is a test index with two keyword fields "region" and "country", to sort by region and country alphabetically, by using script sorting you can do
(In real world, you can simply do
{ "sort": ["region", "country"] }
, this example is just to explain the issue)However, when I use the order method of chewy I can't add more than 1 script sorting
it returns
The region script sorting part is gone.
Expected behavior
Expect query to be like
Actual behavior
Actual query is
Steps to reproduce the problem
Define index
Then in console do
Version Information
Chewy 5.0.0 and 6.0.0 and 7.0.0
Elasticsearch 6.4
ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-darwin19]
Rails 5.1.7
By looking into the source code, I found that the value of Chewy::Search::Parameters::Order is a hash and the issue is because the key of script sorting must always be "_script".
The text was updated successfully, but these errors were encountered: