thichxai
thichxai

Reputation: 1147

Marklogic MLCP with option -query_filter

I have a xquery and want use MLCP with option -query_filter. MLCP tool spool out errors look like it doesn't accept option -query_filter. please give me some hints or example. Thanks in advance. Thichxai

step 1 - I created a query "filter-activity.xqy" below for testing purpose xquery version "1.0-ml";

 fn:doc(cts:uris((),
                 (),
                 cts:collection-query('/activity-all')
                )            
 )

step 2 - I create a text file "export-activity.txt" contains MLCP EXPORT options below

 -username
  admin
 -password
  admin
 -host
  localDEV
 -mode
  local
 -database
  DEV
 -copy_collections
  true
 -copy_permissions
  true
 -query_filter
  filter-activity.xqy
 -output_file_path
  /output/export/data

Step 3 - Execute MLCP

 ./mlcp-8.0-5/bin/mlcp.sh EXPORT -options_file /output/export-activity.txt 

Upvotes: 0

Views: 859

Answers (1)

the -query_filter option requires the actual query.

The query needs to be serialized.

Full documentation here: https://docs.marklogic.com/guide/mlcp/export#id_66898

For you, The query would be:

...
-query_filter
<cts:collection-query xmlns:cts="http://marklogic.com/cts"><cts:uri>/activity-all</cts:uri></cts:collection-query>
...

You can derive that by running this in QConsole:

document { cts:collection-query("activity-all") }

But then again - based on your sample query - I would suggest you just use -collection_filter on the collection name instead.

Upvotes: 3

Related Questions