Hans Hübner
Hans Hübner

Reputation: 61

Sorting /v1/search results

Is there a way to force an ordering on the results of a /v1/search request? It seems that cts:search allows you to order the results based on a range index, but /v1/search does not have a direct way to specify the same options, and stored query options don't seem to support index ordering in the same way.

My question is not related to cts:search, however. I'm looking for a usage example of the /v1/search ReST endpoint with query options that specify sorting. As far as my research has gone, /v1/search has an optional options query parameter which specifies named search options that can be defined using /v1/config/query. At this point, I feel lost in the maze of the documentation and what I'm really looking for is an example.

Upvotes: 1

Views: 113

Answers (1)

kcoleman
kcoleman

Reputation: 666

Have you taken a look at the sort-order query option? It is the equivalent of a cts:order specification on cts:search.

I think you need at least MarkLogic 9.0-3 to get the full slate of sort-order choices. See http://docs.marklogic.com/guide/search-dev/appendixa#id_44212.

Upvotes: 4

Related Questions