Hi, Shiv:

"field" has a special meaning in MarkLogic -- creating a range index on a field 
is different from creating a range index on a JSON property (which is done by 
treating the JSON property as an element with no namespace).

QBE doesn't support fields on the grounds that QBE works with concrete JSON 
properties and XML elements and attributes instead of abstractions.

Anyway, if you did create a range index on the JSON property, you might turn on 
validation of options and queries and inspect the log:

    http://docs.marklogic.com/guide/rest-dev/service#id_61169


Hoping that helps,


Erik Hennum


________________________________
From: [email protected] 
[[email protected]] on behalf of Shiv Shankar 
[[email protected]]
Sent: Wednesday, January 04, 2017 11:48 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] sort-order is not working with REST

Hi Eric,
Yes, range index is there for that field.

--Shan.

On Wed, Jan 4, 2017 at 2:03 PM, Shiv Shankar 
<[email protected]<mailto:[email protected]>> wrote:
Thanks Eric,
With this change, I could get the data, but no order change though the 
sort-order specified ascending/descending.
Lets say firstName is "abc", "xyz", the query returning the response in the 
same order irrespective of sort-order. Am I missing anything?

Regards
Shan.

On Wed, Jan 4, 2017 at 12:05 PM, Shiv Shankar 
<[email protected]<mailto:[email protected]>> wrote:
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

Reply via email to