For completeness, you could also solve this at run time with a User Defined 
Function<http://docs.marklogic.com/guide/search-dev/aggregate#chapter>, but 
you'll find pre-processing much easier. If you decide to go the UDF route, 
here's a post with an 
example<http://blog.davidcassel.net/2012/09/a-mapreduce-aggregation-function-in-marklogic-6/>
 (dated, but still accurate as far as I know).

--
Dave Cassel
Developer Community Manager
MarkLogic Corporation<http://www.marklogic.com/>
Cell:  +1-484-798-8720


From: David Ennis <[email protected]<mailto:[email protected]>>
Reply-To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Date: Friday, October 10, 2014 at 9:13 AM
To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Subject: Re: [MarkLogic Dev General] cts:element-range-query for months in a 
date

I would suggest that you pre-process your documents to include an attribute of 
the xs:gMonth datatype (just the month digits) and add a range index on this.

The the query is absolutely specific:  cts:element-attribute-query([your 
attribute], ">", 10)



Kind Regards,
David Ennis


David Ennis
Content Engineer

[HintTech] <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 63 091 72 80

[http://www.hinttech.com]<http://www.hinttech.com> 
[http://www.hinttech.com/signature/Twitter_HintTech.png] 
<https://twitter.com/HintTech>  
[http://www.hinttech.com/signature/Facebook_HintTech.png] 
<http://www.facebook.com/HintTech>  
[http://www.hinttech.com/signature/Linkedin_HintTech.png] 
<http://www.linkedin.com/company/HintTech>

On 10 October 2014 18:08, Danny Sinang 
<[email protected]<mailto:[email protected]>> wrote:
We have a "publicationDate" element in the form "YYYY-MM-DD".

How do I issue a cts:element-range-query against it to list all documents whose 
publicationDate month is greater than 10 ?



Regards,
Danny





_______________________________________________
General mailing list
[email protected]<mailto:[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