Hi,

 

I have a query to update documents, but when there are many I get the
dreaded XDMP-EXPNTREECACHEFULL error.   I've had luck avoiding this error
when returning large result sets by processing the docs in segments [$start
to $end], but it does not seem to help with the updates.

 

Is there a trick to performing mass updates?  Any advice would be
appreciated.

 

xquery version "1.0-ml";
declare default element namespace
'http://developer.envisn.com/xmlns/envisn/netvisn/';

let $cq := cts:collection-query('audit_history')

let $incr := 100
let $size := xdmp:estimate(cts:search(doc(), $cq, 'unfiltered')) 
let $segs := ceiling($size div $incr) return 
    
for $x in (1 to $segs)
     let $start :=  (($x -1) * $incr) +1 
     let $end := $start + $incr -1 
 
     for $d in cts:search(doc(), $cq, 'unfiltered')[$start to $end]
         let $lk := $d/auditHistory/lookupInfo
         let  $loc := element auditParentDisplayPath
{$lk/parentDisplayPath/text() },
                $name := element auditDefaultName {$lk/defaultName/text() },
                $class := element auditObjectClass {$lk/objectClass/text() }
return
     
         (xdmp:node-replace($lk/parentDisplayPath, $loc),
          xdmp:node-replace($lk/defaultName, $name),
          xdmp:node-replace($lk/objectClass, $class), 
      
          for $u in $d/auditHistory//Action/user
            let $uname :=  element auditUserName {$u/username/text() }
return
            xdmp:node-replace($u/username, $uname) 
          ) 




Thanks,

 

Gary Larsen

Envisn Inc.

508-259-6465

 

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to