Hi, To answer your question directly, yes, you can run a search within an MLCP transform.
Regarding your specific transform, how big is the "docs" collection? If you're trying to paste a large number of other documents and their URIs into the incoming document you're probably going to run into some pretty big problems. This leads me to ask, why are you trying to paste an entire collection of documents and URIs into an incoming document in the first place? There's probably a better way to do this. Best, Rob Rob Szkutak Senior Consultant MarkLogic Corporation [email protected] www.marklogic.com<http://www.marklogic.com> ________________________________ From: [email protected] [[email protected]] on behalf of Aries Li [[email protected]] Sent: Wednesday, June 22, 2016 12:45 PM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] MLCP import transform and search Hi Frank, If you login QConsole with $USER that was passed into mlcp, can you get result by running the cts query in the transform module? I expect mlcp transform module can run the query with privileges from $USER. Aries From: [email protected] [mailto:[email protected]] On Behalf Of [email protected] Sent: Wednesday, June 22, 2016 8:48 AM To: [email protected] Subject: [MarkLogic Dev General] MLCP import transform and search Hi, Is it possible in MLCP IMPORT within a TRANSFORM to search on the (same) database? To enrich the data (from same database) I use the transform option. But in below transformation the raw data is loaded in the database with empty elements a,b and c (structure is ok) Questions: - is it possible to do a MLCP IMPORT with a search in a transform (xquery) and get data from same (sub-)database - or do I have to adjust my security role (Which role do I need, currently I use role admin ) - or ............. MLCP call: mlcp.sh import \ -mode local \ -host localhost \ -port $PORT \ -username $USER \ -password $PASS \ -input_file_path /home/cent/Desktop/$SRCS \ -document_type xml \ -input_file_type aggregates \ -aggregate_record_element record \ -database Dummy \ -content_encoding "UTF-8" \ -namespace http://ml.com/$SRCS \ -output_collections $COLL \ -transform_module /src/transform/transform.xqy \ -transform_namespace http://ml.com/mlcp-transform \ -transform_param $PARM \ -tolerate_errors true \ -xml_repair_level full /src/transform/transform.xqy: xquery version "1.0-ml"; module namespace ingest = "http://ml.com/mlcp-transform"; declare function ingest:transform( $content as map:map, $context as map:map ) { let $doc := map:get($content, "value") (: Normally the below search function are more specific based on element values in $doc :) let $a := cts:search(fn:doc(), cts:collection-query("docs"), "unfiltered") let $b := cts:uris((),(),cts:collection-query("docs")) let $c := fn:collection("docs")[1] (: removed transformation part :) (: but $a, $b and $c are empty :) (: Same function in QControl gives results :) let $_1 := <new-record> <raw>{$doc}</raw> <a>{$a}</a> <b>{$b}</b> <c>{$c}</c> </new-record> let $_2 := map:put($content, "value", $_1) return $content }; Kind Regards, Frank Jansen This message has been sent by ABN AMRO Bank N.V., which has its seat at Gustav Mahlerlaan 10 (1082 PP) Amsterdam, the Netherlands, and is registered in the Commercial Register of Amsterdam under number 34334259.
_______________________________________________ General mailing list [email protected] Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
