In the options, specify the range index collation too. Do this whenever you refer to the range index. For example:
http://docs.marklogic.com/guide/rest-dev/appendixb#id_33716 <sort-order type="xs:string" collation="http://marklogic.com/collation/codepoint" direction="ascending"> <element ns="http://purl.org/dc/elements/1.1/" name="title"/> </sort-order> Without the collation, the evaluator will look for a range index in the default collation. That's usually the root collation, and it's the default collation for the current evaluation scope, *not* the database default collation. So it's a good idea to specify the collation to your configuration wherever you refer to the range index. -- Mike On 9 Feb 2014, at 21:51 , <[email protected]> <[email protected]> wrote: > Hi All, > > I am trying to sort the productset xml on title in ascending order. It is > working fine for the documents which I newly create. But it is giving the > wrong result for the existing documents. > > My requirement is to sort the title element which will display the title in > the ascending order as given below:- > > _productSet > @grade1 > 1grade > Bgrade > Grade1 > bgrade > grade2 > > i.e. title would be in the order which starts with special character, then > numbers, then upper case characters and at the last lower case characters. > > The structure of product set xml is like and will be present in collection > like http://pcenamespace/productsets : > > <pce:productSet> > <dc:identifier>1680174081022788315</dc:identifier> > <pce:program-id>7937430281626559657</pce:program-id> > <dc:title>_ productSet</dc:title> > …........................................ > <pce:productSet> > > > I have following search options and constraints, and I have created range > index for program-id in the database, and database have default collation as > http://marklogic.com/collation/codepoint :: > > > <options xmlns="http://marklogic.com/appservices/search"> > <constraint name="ProgramID"> > <range type="xs:unsignedLong" facet="false"> > <element ns="http://pcenamespace" name="program-id" /> > </range> > </constraint> > <constraint name="Show"> > <collection prefix="http://pcenamespace/" facet="false" /> > </constraint> > <operator name="sort"> > <state name="relevance"> > <sort-order> > <score /> > </sort-order> > </state> > <state name="titleAscending"> > <sort-order direction="ascending" type="xs:string"> > <element ns="http://purl.org/dc/elements/1.1/" > name="title" /> > </sort-order> > </state> > <state name="titleDescending"> > <sort-order direction="descending" type="xs:string"> > <element ns="http://purl.org/dc/elements/1.1/" > name="title" /> > </sort-order> > </state> > </operator> > </options> > > I am using the following query to fetch the results: > > query=ProgramID:7937430281626559657 Show:productsets sort:titleAscending > > > > Thanks, > Abhinav Kumar Mishra > > 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 > [email protected] > http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
