Hi, Shiv:
The $query and options can be sibling properties in a QBE payload
for MarkLogic 8.
The basic JSON structure when combining a query and options is:
{"search":{
"$query": ... the QBE query ...,
"$format": ... the QBE optional format ...,
"$validate": ... the QBE optional validation ...,
"options": ... the search options ...
}}
You can also persist the options and name them on the query:
http://docs.marklogic.com/guide/search-dev/qbe#id_32338
(As a footnote, it's also possible to omit the search container
property when sending a $query without options.)
In the example of options from the question, the JSON property
and score should be separate objects:
http://docs.marklogic.com/guide/search-dev/appendixa#id_44212
Hoping that helps,
Erik Hennum
________________________________
From: [email protected]
[[email protected]] on behalf of Shiv Shankar
[[email protected]]
Sent: Wednesday, January 04, 2017 9:05 AM
To: MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] sort-order is not working with REST
Hi,
I am trying to use sort-order in $query. It is returning 0 records. All my
documents are JSON. Any inputs?
{"$query":{"options":{"sort-order":[{"direction":"descending","element":{"name":"firstName","score":
null}}]}}}
Tried with
{"$query":{"options":{"sort-order":[{"direction":"descending","json-property":"firstName"}]}}}
Note: I created Index on that field too.
Regards
Shan.
_______________________________________________
General mailing list
[email protected]
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general