Hi, I am very new to both MarkLogic and xQuery and this is my first post here. My question is as follows:
I am trying to count documents that meet certain criteria and also fall into particular date range (such as within 14 days window from today). I am experimenting with fn:count and xdmp:estimate, e.g.: let $count3D := fn:count( fn:collection()/example[State="TX" and ( xs:dateTime( SubmitDate ) > ( fn:current-dateTime() - xs:dayTimeDuration( "P14D") ) )]) or let $count3D := xdmp:estimate( fn:collection()/example[State="TX" and ( xs:dateTime( SubmitDate ) > ( fn:current-dateTime() - xs:dayTimeDuration( "P14D") ) )]) Sure enough, the fn:count gives the correct answer but is rather slow, whereas xdmp:estimate() is very fast but it appears to be only filtering the count by state and completely ignores the dateTime-based criteria so it's grossly incorrect. Any advice on where I go from here - for either making fn:count() faster or making xdmp:estimate() more accurate? Either creating some kind of index or improving the query syntax or both? I tried creating a range path index on example/SubmitDate path but it did not seem to help anything so I am not sure I am on the right track - I'd appreciate any clues or pointers on how to approach this correctly. Thanks, [Forward Slash] [Elevate] Alexei Betin Principal Architect; Big Data P: (817) 928-1643 | Elevate.com<http://www.elevate.com> 4150 International Plaza, Suite 300 Fort Worth, TX 76109 Privileged and Confidential. This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain privileged and/or confidential information. If you have received this e-mail in error, please notify me immediately by a return e-mail and delete this e-mail. You are hereby notified that any dissemination, distribution or copying of this e-mail and/or any attachments thereto, is strictly prohibited.
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
