Closed cenguix closed 8 years ago
I've checked it, and the problem is that _sortby query parameter does not support json mongodb sort expressions but just field names.
According to the documentation, it has the following format:
sort_by=[+|-]<fieldname>
We will add support for mongodb json sort expression; I'm already working on it and will let you know when ready.
For information refer to jira improvement task https://softinstigate.atlassian.net/browse/RH-190
Thanks
done.
you can try the snapshot build restheart-2.1.0-20160503.105713-2.tar.gz.
please check if it is working, when confirmed we'll release version 2.0.1 with it.
Hi Andrea: At least all the tests that I have performed with text search score are ordered descending as done in the Mongodb shell. Well done and thanks for fixing the bug soon. RestHeart Rocks!
Hi @cenguix
FYI 2.0.1 is out with support for sort_by json expression format
also docs updated https://softinstigate.atlassian.net/wiki/x/XACk#QueryDocuments-Sortbysearchscore
Hi Andrea, Maurizio and the RestHeart team:
I am working with RestHeart and httpie issuing REST queries. I am aware that the sort_by field works fine for other fields but in the case of text search it is ignored. I tried everything but nothing works. In MongoDB shell it works fine this query:
In the sort field I cannot put instead {'score':1} because it returns the following error:
Therefore in the sort field I am forced to insert the $meta project operator with the textScore keyword.
I am using httpie for issuing queries because it is very easy to read the json results as compared to curl. The following GET REST operation that I am having trouble is:
And the json result is the following:
As you can see the results are not ordered by score descendently as done in the MongoDB shell.
Please let me know if this is a bug for text search or something that I am missing in the httpie request to RestHeart