-
Notifications
You must be signed in to change notification settings - Fork 16
Adhoc Modules
Appending |ADHOC
to the name or path of a XQuery module (with .xqy extension) or JavaScript module (with .sjs or .js extension) will cause the module to be read from the file system and executed in MarkLogic without being uploaded to Modules database. This simplifies running CORB jobs by not requiring deployment of any code to MarkLogic, and makes the set of CORB files and configuration more self contained.
INIT-MODULE, URIS-MODULE, PROCESS-MODULE, PRE-BATCH-MODULE and POST-BATCH-MODULE can be specified adhoc by adding the suffix |ADHOC
for XQuery or JavaScript (with .sjs or .js extension) at the end. An adhoc XQuery or JavaScript module remains local to the CORB and is not deployed to MarkLogic. The XQuery or JavaScript module should be in its named file and that file should be available on the file system, including being on the java classpath for CORB.
-
PRE-BATCH-MODULE=adhoc-pre-batch.xqy|ADHOC
adhoc-pre-batch.xqy must be on the classpath or in the current directory. -
PROCESS-MODULE=/path/to/file/adhoc-transform-module.xqy|ADHOC
XQuery module file with full path in the file system. -
URIS-MODULE=adhoc-uris.sjs|ADHOC
Adhoc JavaScript module in the classpath or current directory.
It is also possible to set a module option with inline code blocks, rather than a file path. This can be done by prepending either INLINE-XQUERY|
or INLINE-JAVASCRIPT|
to the option value, followed by the XQuery or JavaScript code to execute. Inline code blocks are executed as ad-hoc modules and are not uploaded to the Modules database. The |ADHOC
suffix is optional for inline code blocks.
URIS-MODULE=INLINE-XQUERY|let $uris := cts:uris('',(),cts:collection-query('foo')) return (count($uris),$uris)