Search code examples
marklogicmarklogic-8mlcp

MLCP Export Selected Documents using document selector


i want to export selected documents from MarkLogic using MLCP based on xpath match.

mlcp export -host localhost -port 8061 -username admin -password admin -mode local -output_file_path shiv -database shiv -output_type archive -document_selector '/companymetadata/companyCode=shiv'

here i want to export all the documents which matches /companymetadata/companyCode=shiv this condition but i am getting following error

18/06/06 16:50:57 INFO contentpump.ContentPump: Job name: local_712261411_1
18/06/06 16:50:57 ERROR mapreduce.MarkLogicInputFormat: com.marklogic.xcc.exceptions.XQueryException: XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error, unexpected QName_, expecting Rpar_
 [Session: user=admin, cb=shiv [ContentSource: user=admin, cb=shiv [provider: address=localhost/127.0.0.1:8061, pool=1/64]]]
 [Client: XCC/9.0-3, Server: XDBC/8.0-5.5]
in /eval, on line 4
expr:
18/06/06 16:50:57 ERROR mapreduce.MarkLogicInputFormat: Query: xquery version "1.0-ml";
import module namespace hadoop = "http://marklogic.com/xdmp/hadoop" at "/MarkLogic/hadoop.xqy";
xdmp:host-name(xdmp:host()),
hadoop:get-splits('', ''collection()/companymetadata/companyCode=shiv'','()'),
"REDACT",0,let $repf := fn:function-lookup(xs:QName('hadoop:get-splits-with-replica'),0)
return if (exists($repf)) then $repf() else ()
,0,"AUDIT",
let $f :=
    fn:function-lookup(xs:QName('xdmp:group-get-audit-event-type-enabled'), 2)
return
    if (not(exists($f)))
    then ()
    else
        let $group-id := xdmp:group()
        let $enabled-event := $f($group-id,("mlcp-copy-export-start", "mlcp-copy-export-finish"))
        let $mlcp-start-enabled :=
                if ($enabled-event[1]) then "mlcp-copy-export-start" else ()
        let $mlcp-finish-enabled :=
                if ($enabled-event[2]) then "mlcp-copy-export-finish" else ()
        return ($mlcp-start-enabled, $mlcp-finish-enabled)
18/06/06 16:50:57 ERROR contentpump.LocalJobRunner: Error getting input splits:
18/06/06 16:50:57 ERROR contentpump.LocalJobRunner: com.marklogic.xcc.exceptions.XQueryException: XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error, unexpected QName_, expecting Rpar_
 [Session: user=admin, cb=shiv [ContentSource: user=admin, cb=shiv [provider: address=localhost/127.0.0.1:8061, pool=1/64]]]
 [Client: XCC/9.0-3, Server: XDBC/8.0-5.5]
in /eval, on line 4
expr:

Please help me to solve above error also guide me to use xpath with MLCP.


Solution

  • There's an example of xpath use at http://docs.marklogic.com/guide/mlcp/export#id_89322 so it looks possible. I would recommend generally to work up your xpath so it works in query console first, then try in mlcp. Maybe you want something like

    /companymetadata[companyCode = 'shiv']