Created
December 11, 2020 14:58
-
-
Save ableasdale/450cd159db4c4c12c122c84bb38d35cf to your computer and use it in GitHub Desktop.
MarkLogic: Remove a problem directory fragment in an event where you encounter XDMP-DBDUPURI issues
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "1.0-ml"; | |
(: | |
A Utility module to allow the deletion of a directory fragment in a given forest in the event of | |
an XDMP-DBDUPURI exception. | |
:) | |
let $doc := "/" (: URI for the conflicting directory that is causing an XDMP-DBDUPURI to be reported in 2 forests :) | |
let $forest-name := "forest_00" (: The name of the forest from which the problem directory fragment should be removed :) | |
let $query := | |
'xquery version "1.0-ml"; | |
declare variable $URI as xs:string external; | |
xdmp:node-delete(xdmp:document-properties($URI))' | |
let $options := <options xmlns="xdmp:eval"><database>{xdmp:forest($forest-name)}</database></options> | |
return xdmp:eval($query,(xs:QName("URI"),$doc),$options) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment