Hi Gnanaprakash,

This should work for sorting by field in REST/Search API:

<options>
<sort-order type="xs:string" collation=".."><field 
name="fieldName"/></sort-order>
</options>

The type and collation have to match your field range index (and you do need 
that field range index).

Use return-plan to ensure that you're using the index.

Charles



Charles Greer
Senior Engineer
MarkLogic Corporation
charles.gr...@marklogic.com
Phone: +1 650 287 2569
Cell:  +1 707 318 0442
www.marklogic.com

This e-mail and any accompanying attachments are confidential. The information 
is intended solely for the use of the individual to whom it is addressed. Any 
review, disclosure, copying, distribution, or use of this e-mail communication 
by others is strictly prohibited. If you are not the intended recipient, please 
notify us immediately by returning this message to the sender and delete all 
copies. Thank you for your cooperation.
________________________________
From: general-boun...@developer.marklogic.com 
[general-boun...@developer.marklogic.com] on behalf of David Ennis 
[david.en...@dayon.nl]
Sent: Tuesday, February 25, 2014 5:07 AM
To: general@developer.marklogic.com
Subject: Re: [MarkLogic Dev General] Best approach for sorting content based on 
a field/element

HI.

The first thing I can think of is to make sure that your field/element you are 
sorting on is indexes.

Seprately, if you are using a FLWOR statement for  your sorting (perhaps the 
result of cts:search, this works if you are sorting directly on the results. 
But if doing it later  - like assigning the results to a variable and then 
applying FLWOR, then you no longer are benefiting from the indexes.

Do you have a sample?

Kind Regards,
David

On 25/02/14 11:14, 
gnanaprakash.bodire...@cognizant.com<mailto:gnanaprakash.bodire...@cognizant.com>
 wrote:
Hi

I am trying to see the best approach to sort the content/results in REST.

We have millions of files in our DB and when we try to use sort field it gives 
expand tree cache exception.

What is the best approach to include sorting on a specific field?

Regards,
Gnanaprakash Bodireddy


This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful.


_______________________________________________
General mailing list
General@developer.marklogic.com<mailto:General@developer.marklogic.com>
http://developer.marklogic.com/mailman/listinfo/general



--


David Ennis

Content Engineer


[HintTech Mastering the value of content]<http://www.hinttech.com>
Mastering the value of content
creative | technology | content


Delftechpark 37i
2628 XJ Delft
The Netherlands
T:      +31 88 268 25 00

M:      +31 6 000 000 00



[Website]<http://www.hinttech.com>      [Twitter] 
<https://twitter.com/HintTech>        [Facebook] 
<http://www.facebook.com/HintTech>   [LinkedIn] 
<http://www.linkedin.com/company/HintTech>


[HintTech Mastering the value of content]<http://www.dayon.nl>

_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to