Hi,

The below code is giving me time limit exceeded error.


let $docListExtra := fn:doc("/misc/Extra.xml")/Extra
let $metaUris := cts:uri-match("/metadata/*.xml")

for $metaUri in $metaUris

       return
          xdmp:spawn("spawn-walk.xqy",
                (xs:QName("metaUri"),$metaUri, xs:QName("docListExtra"), 
$docListExtra),
                <options xmlns="xdmp:eval">
                  <result>true</result>
                  <priority>higher</priority>
                </options>))



In spawn.xqy:

xquery version "1.0-ml";

declare variable $metaUri as xs:string external;
declare variable $docListExtra external;

let $metaDoc := fn:doc($metaUri)
let $uri := fn:replace($metaUri,"/metadata/",'/docs/')
let $extraDoc := $docListExtra/Document[ID/text() = $uri]


(:Adding agreement type :)
let $d :=fn:concat($metaDoc/Document/x/text(),"-",$metaDoc/Document/y/text())


return

(xdmp:node-insert-child($metaDoc/Document,<a>{fn:data($extraDoc//CustomMetadata/Field[@ID
 = "a"])}</a>),

xdmp:node-insert-child($metaDoc/Document,<b>{fn:data($extraDoc//CustomMetadata/Field[@ID
 = "b"])}</b>),
xdmp:node-insert-child($metaDoc/Document,<c>{fn:data($extraDoc//CustomMetadata/Field[@ID
 = "c"])}</c>),
xdmp:node-insert-child($metaDoc/Document,<d>{$d}</d>),
xdmp:node-replace($metaDoc/Document/ID,<DocId>{$metaDoc/Document/ID/text()}</DocId>)
)

Please let me know, if I am doing something in incorrect manner.

Thanks
Pragya


"This e-mail and any attachments transmitted with it are for the sole use of 
the intended recipient(s) and may contain confidential , proprietary or 
privileged information. If you are not the intended recipient, please contact 
the sender by reply e-mail and destroy all copies of the original message. Any 
unauthorized review, use, disclosure, dissemination, forwarding, printing or 
copying of this e-mail or any action taken in reliance on this e-mail is 
strictly prohibited and may be unlawful."
_______________________________________________
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to