-
Notifications
You must be signed in to change notification settings - Fork 61
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
allow custom order by #203
Conversation
Does Elastic support all types of queries in a sort? |
…nly_accepts_syntax_interface_classes
not sure about all types of queries, but some of them it certainly accepts. Using this feature in my current project. Also, I have fixed failing tests. Thanks for the answer |
This change allows all queries, if it's only a few I'd rather have it typed more strictly. Thanks for contributing btw! |
Can you find a list of the allowed queries? |
I have checked the list of allowed options in sort section, and after my research I dont think that its possible to create one interface that will cover all cases. Here is the list : https://www.elastic.co/guide/en/elasticsearch/reference/current/sort-search-results.html So I think that we can stick with SyntaxInterface solution. What do you think about it ? |
Oh boy there are some funky things. Regarding your tests: phpunit is only for the unit tests, there is also infection PHP for mutation tests and those fail. |
|
Im working on fixing mutations, just dont know how to proceed. Investigating |
It usually means a case is not tested. |
Nested sort ability was broken by this PR :( #217 |
Some people might wanna use more complex order by statements like this:
"sort": [
{
"prices.value": {
"order": "desc",
"nested": {
"path": "prices",
"filter": {
"term": {
"prices.shop_id": "6f8c648c-112e-43ad-a93d-7ca72ea90aee"
}
}
}
}
}
]
So I think it wise to allow adding SyntaxInterface objects to the ScoutSearchCommandBuilder's $sort array, and not just Sort objects.
Thanks