Skip to content

Instantly share code, notes, and snippets.

@ableasdale
Created December 11, 2020 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ableasdale/64d11a957e166d8ac706699b162078b4 to your computer and use it in GitHub Desktop.
Save ableasdale/64d11a957e166d8ac706699b162078b4 to your computer and use it in GitHub Desktop.
MarkLogic: Look up duplicate URIs using the URI Lexicon (for troubleshooting XDMP-DBDUPURI exceptions)
xquery version "1.0-ml";
(:
A Utility module to allow the detection of duplicate URIs for a given database
This can be used in any situation where XDMP-DBDUPURI messages are found in the ErrorLogs
URIs are sorted by frequency order so higher frequencies (e.g. > 1) indicate that the URI
has been found in more than one forest
This module requires the uri lexicon to be enabled on your database
:)
for $uri at $i in cts:uris ((), ('frequency-order', 'descending', 'document'))
let $freq := cts:frequency($uri)
where $freq > 1
return ($uri||': '||$freq)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment