Marklogic Corb export data as compress

68 Views Asked by At

Can MarkLogic Corb export as a zip for every two thousand XML files? I appreciate any example you can provide.

1

There are 1 best solutions below

2
Mads Hansen On

If you are writing each of the docs using PROCESS-TASK=com.marklogic.developer.corb.ExportToFileTask and POST-BATCH-TASK=com.marklogic.developer.corb.PostBatchUpdateFileTask, then you can enable the option EXPORT_FILE_AS_ZIP=true and it will compress the files in the directory using EXPORT_FILE_NAME, EXPORT-FILE-DIR, optionally EXPORT_FILE_PART_EXT (defaults to using ".zip").

XCC-CONNECTION-URI=xcc://user:password@localhost:8000
URIS-MODULE=/path/to/uris.xqy|ADHOC
PROCESS-MODULE=/path/to/process.xqy|ADHOC

PROCESS-TASK=com.marklogic.developer.corb.ExportToFileTask
EXPORT-FILE-DIR=/tmp
EXPORT_FILE_NAME=MyExport
POST-BATCH-TASK=com.marklogic.developer.corb.PostBatchUpdateFileTask
EXPORT_FILE_AS_ZIP=true

You can't limit how many docs to put into the zip with the built-in PostBatchUpdateFileTask, but you could extend that class and configure your own custom POST-BATCH-TASK class to be used instead, or you could break up the CoRB job into sets of 2,000 URIs at a time.