Thanks, Danny. I tried a docs search for 'xdmp:document' - but unsurprisingly 
didn't find that section because so many API functions start with that string.

-- Mike

On 9 Aug 2012, at 11:43 , Danny Sokolsky wrote:

> FWI, it is documented in a note in this section of the Lexicon chapter of the 
> Search Developer's Guide:
> 
> http://docs.marklogic.com/5.0doc/docapp.xqy#display.xqy?fname=http://pubs/5.0doc/xml/search-dev-guide/lexicon.xml%2345107
> 
> -Danny
> 
> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Michael Blakeley
> Sent: Thursday, August 09, 2012 11:34 AM
> To: MarkLogic Developer Discussion
> Subject: Re: [MarkLogic Dev General] cts query for sorting
> 
> Not directly, but you might be able to use co-occurrences instead.
> 
> I don't think this is documented, but you can access the uri lexicon as if it 
> were an element lexicon named xdmp:document in the codepoint collation. If 
> you request the co-occurrences of contentCreated and xdmp:document, in that 
> order, the results should be sorted by contentCreated. You can include a 
> query, too.
> 
> cts:element-value-co-occurrences(
>  xs:QName('contentCreated'), xs:QName('xdmp:document'),
>  ('collation-2=http://marklogic.com/collation/codepoint'),
>  $query)
> 
> To get just the URIs, add another XPath step to the expression.
> 
> cts:element-value-co-occurrences(
>  xs:QName('contentCreated'), xs:QName('xdmp:document'),
>  ('collation-2=http://marklogic.com/collation/codepoint'),
>  $query)/cts:value[2]/string()
> 
> -- Mike
> 
> On 9 Aug 2012, at 07:14 , Alvaro San Millan wrote:
> 
>> Hi all,
>> 
>> I am having problem to find a cts query to sort the output of this query:
>> 
>> let $query := cts:and-query((
>>  cts:directory-query("/mint/"),
>>  cts:element-attribute-value-query(xs:QName("panar:pageInfo"), 
>> xs:QName("idref"), "page1"),
>>  cts:not-query(cts:element-query(xs:QName("nar:role"), 
>> cts:and-query(()))),
>>  cts:not-query(cts:element-query(xs:QName("df:dataFormat"), 
>> cts:and-query(())))
>> ))
>> 
>> let $uris := cts:uris(
>>  '', ('document'), $query )
>> return (count($uris), $uris)
>> 
>> 
>> What I would like is to sort documents in /mint directory by 
>> contentCreated, which is an element in those documents, and then return 
>> the uris in ascending order by this contentCreated. Is there any cts 
>> query to sort documents by an element in the xml files in /mint?
>> 
>> Kind Regards,
>> 
>>  Alvaro
>> 
>> _______________________________________________
>> General mailing list
>> [email protected]
>> http://developer.marklogic.com/mailman/listinfo/general
>> 
> 
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
> 

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to