Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to list all the URI of all documents in a directory in marklogic

Hi how can i retrieve the URI of all the documents in directory. I create the below xquery to achieve that but that doesn't helps.

for $i in xdmp:directory("/Test/performance/results/","infinity")
let $k := document-uri(fn:doc($i))
return <li>{$k}</li>
like image 973
Ambuj Jauhari Avatar asked Dec 11 '22 03:12

Ambuj Jauhari


2 Answers

For efficiency you should use the URI lexicon.

cts:uris((), (), cts:directory-query("/Test/performance/results/","infinity"))

See https://docs.marklogic.com/cts:uris for documentation.

like image 132
mblakele Avatar answered Jan 21 '23 04:01

mblakele


How about:

xdmp:directory("/Test/performance/results/","infinity") !
    <li>{fn:document-uri(.)}</li>
like image 39
adamretter Avatar answered Jan 21 '23 06:01

adamretter