Skip to content

Instantly share code, notes, and snippets.

@ryanjdew
Created January 7, 2013 04:44
Show Gist options
  • Save ryanjdew/4472397 to your computer and use it in GitHub Desktop.
Save ryanjdew/4472397 to your computer and use it in GitHub Desktop.
This can help you to find empty directories if the uri lexicon is enabled in MarkLogic.
xquery version "1.0-ml";
let $directories-map := (cts:uris('/',('properties','map'),cts:directory-query('/','infinity'))
-
cts:uris('/',('document','map'),cts:directory-query('/','infinity')))
return map:keys($directories-map)[xdmp:estimate(cts:search(fn:collection(),cts:directory-query(.,'infinity'))) eq 0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment