marklogicmarklogic-corb

MarkLogic Corb SEVERE: received more than 1 results: 1


I have a MarkLogic CoRB job. It should returns 100 records. But it fails for SEVERE: received more than 1 results: 1.

I really appreciate any help you can provide.

uris.xqy:

declare namespace lab = "http://labs.com/record";
declare namespace meta="http://labs.com/lab/record/meta";
let $org := ("Ros* Lab*")
for $uri in cts:uris(
                     (),
                     (),
               cts:and-query((
                  cts:collection-query('/Lab'),
                  cts:field-range-query("updated","<","2023-08-18"),
                  cts:or-query((
                      cts:field-word-query("do",$org,"case-insensitive"),
                ))
            ))
        )
 return (count($uri),$uri)

uris-process.xqy:

xquery version "1.0-ml";
declare namespace lab = "http://labs.com/record";
declare namespace meta="http://labs.com/lab/record/meta";
declare variable $URI as xs:string external;
xdmp:set-request-time-limit(3600),

for $uris in $URI
let $doc := fn:doc($uris)
let $meta := <lab:Record><meta:Metadata>

                 $doc//meta:IDNumber}
                 {$doc//meta:ReportDate}
                 {$doc//meta:ReportNumbers}
             </meta:Metadata></lab:Record>

 let $IDNumber := fn:data($meta//meta:IDNumber)

return
xdmp:save(fn:concat("/XML/",$IDNumber,".xml")$IDNumber ,$meta)

Produces this exception:

SEVERE: interrupted: exiting
java.lang.InterruptedException
        at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2014)
        at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2088)
        at java.util.concurrent.LinkedBlockingQueue.poll(LinkedBlockingQueue.java:467)
        at java.util.concurrent.ExecutorCompletionService.poll(ExecutorCompletionService.java:202)
        at com.marklogic.developer.corb.Monitor.monitorResults(Monitor.java:97)
        at com.marklogic.developer.corb.Monitor.run(Monitor.java:76)
        at java.lang.Thread.run(Thread.java:750)

Sep 11, 2023 3:32:41 PM com.marklogic.developer.corb.Manager run
SEVERE: received more than 1 results: 1
Sep 11, 2023 3:32:41 PM com.marklogic.developer.corb.Manager stop
INFO: cleaning up
Sep 11, 2023 3:32:41 PM com.marklogic.developer.corb.Manager main
SEVERE: Error while running CORB
java.lang.ArrayIndexOutOfBoundsException: received more than 1 results: 1

Solution

  • Your URIs module doesn't look right.

    You are iterating over each URI with a for loop.

    for $uri in cts:uris(
    

    and then for each of those URIs you are returning a count (of one) and then the $uri, for each of the 100 URIs.

    So, the first thing returned in your job is the count of 1, but then you are returning 199 other items in the sequence.

    You want to instead let a $uris variable

    let $uris := cts:uris(
    

    and then return only one sequence that has the count and then each of the $uris.

    return (count($uris), $uris)