Hi,
Would someone have some suggestions for improving the following query? Doesn't
seem to be utilising the range index we have setup on timeCode.
We do not have uri-lexicon switched on so don't think we can make use of
cts:element* functions.
Thanks
Jon
declare variable $documentUri := '/stats/';
declare variable $value := ' OBS-AT001-0569';
declare variable $windowStart := xs:dateTime('2012-05-08T16:15:00.000+01:00');
declare variable $windowEnd := xs:dateTime('2012-05-08T16:14:00.000+01:00');
declare variable $limit := 20;
if ( $windowStart > fn:current-dateTime() )
then ()
else (
<document>{
let $seq := for $d in xdmp:directory($documentUri, "infinity")
where $d/document/header/video/session/@id=$value
and xs:dateTime($d/document/header/video/timeCode) >= $windowStart
and xs:dateTime($d/document/header/video/timeCode) <= $windowEnd
order by xs:dateTime($d/document/header/video/timeCode) descending
return xdmp:node-uri($d)
for $top in $seq[position() <= $limit]
return <stat>{fn:doc($top)/document/element()}</stat>
}</document>
), xdmp:query-meters()
_______________________________________________
General mailing list
[email protected]
http://community.marklogic.com/mailman/listinfo/general