[MarkLogic Dev General] MLCP input query

Prasanth N V R prasanth.nvr04 at gmail.com
Tue Jan 26 05:25:04 PST 2016


Thanks Peter.

-directory_filter works for me. It is able to copy documents based on this.

In general, I am curious to know how to send the uris as INPUT_QUERY
similar to how we do in XQSync.

In XQSync, the INPUT_QUERY will be given as -
cts:uris((),(),cts:element-value-query(xs:QName("bucket"),"samplequestion")).
This takes all the uris matching this query and processed.

But I do not know how to achieve this in MLCP.

If you suggest some working example it would be great.

On Tue, Jan 26, 2016 at 3:16 AM, Peter Kester <Peter.Kester at marklogic.com>
wrote:

> Hi Prasanth,
>
> Just checked the docs:
>
> You need to quote the cts:query
> Sou your query_filter needs to be:
> -query_filter
> 'cts:directory-query("/Default/samplestack/rest-api/options/","infinity”)’
> according to the doc, but you would probably be better off with the
> directory_filter option if you just want to select documents from a given
> directory inside ML.
> Check this section of the documentation:
> https://docs.marklogic.com/guide/mlcp/export#id_47556
>
> HTH
>
> Peter
>
>
> From: <general-bounces at developer.marklogic.com> on behalf of Prasanth N V
> R
> Reply-To: MarkLogic Developer Discussion
> Date: Tuesday 26 January 2016 04:10
> To: MarkLogic Developer Discussion
> Subject: Re: [MarkLogic Dev General] MLCP input query
>
> Thanks for the reply Peter.
>
> I tried giving it as cts:query(in xml format).
> -query_filter '<cts:directory-query depth="infinity" xmlns:cts="
> http://marklogic.com/cts
> "><cts:uri>/Default/samplestack/rest-api/options/</cts:uri></cts:directory-query>'
>
> But it is throwing error like - < was unexpected at this time.
>
> In general, I am curious to know how to send the uris as INPUT_QUERY
> similar to how we do in XQSync.
>
> In XQSync, the INPUT_QUERY will be given as -
> cts:uris((),(),cts:directory-query("/Default/samplestack/rest-api/options/","infinity")).
> This takes all the uris matching this query and processed.
>
> But I do not know how to achieve this in MLCP.
>
> Thanks,
> Prasanth
>
> On Mon, Jan 25, 2016 at 2:58 AM, Peter Kester <Peter.Kester at marklogic.com>
> wrote:
>
>> Hi Prasanth,
>>
>> Try making that cts:directory-query an xml representation.
>> Like this:
>> -query-filter <cts:directory-querydepth="infinity"xmlns:cts="
>> http://marklogic.com/cts">
>> <cts:uri>
>> /Default/samplestack/rest-api/options/
>> </cts:uri>
>> </cts:directory-query>
>>
>> Doc says:
>>
>> -query_filter *string*
>>
>> Specifies a query to apply when selecting documents for export. The
>> argument must be the XML serialization of a cts:query or JSON serialization
>> of a cts.query. Only documents matching the query are considered for
>> export; false positives are possible. For details, seeControlling What
>> is Exported, Copied, or Extracted
>> <https://docs.marklogic.com/guide/mlcp/export#id_47556>.
>>
>> HTH.
>>
>> Peter
>>
>> From: <general-bounces at developer.marklogic.com> on behalf of Prasanth N
>> V R
>> Reply-To: MarkLogic Developer Discussion
>> Date: Monday 25 January 2016 04:59
>> To: MarkLogic Developer Discussion
>> Subject: Re: [MarkLogic Dev General] MLCP input query
>>
>> Thanks for you reply Christopher.
>>
>> Yes. I tried that too. But I am getting error.
>>
>> mlcp.bat copy -input_host localhost -input_port 5767 -input_username
>> admin -input_password admin ^
>> -output_host localhost -output_port 5767 -output_username admin
>> -output_password admin ^
>> -input_database samplestack-modules ^
>> -output_database Documents ^
>> -query_filter
>> cts:directory-query("/Default/samplestack/rest-api/options/","infinity")
>>
>> ERROR mapreduce.MarkLogicInputFormat:
>> com.marklogic.xcc.exceptions.XQueryException: XDMP-DOCROOTTEXT:
>> xdmp:unquote("cts:directory-query(/Default/samplestack/rest-api/options/,infin...")
>> -- Invalid root text
>> "cts:directory-query(/Default/samplestack/rest-api/options/,infinity)" at
>>  line 1
>>  [Session: user=admin, cb=samplestack-modules [ContentSource: user=admin,
>> cb=samplestack-modules
>>
>> Thanks,
>> Prasanth
>>
>> On Sun, Jan 24, 2016 at 7:27 PM, Christopher Hamlin <cbhamlin at gmail.com>
>> wrote:
>>
>>> It looks to me like you are sending in a search, not a query.
>>>
>>> So maybe try
>>>
>>> -query_filter cts:directory-query("/Default/
>>> samplestack/rest-api/options/","infinity")
>>>
>>> instead.
>>>
>>>
>>> On Sun, Jan 24, 2016 at 7:22 PM, Prasanth N V R <
>>> prasanth.nvr04 at gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I am trying to copy documents from one DB to another DB using MLCP.
>>>>
>>>> Here is my command(running in Windows)
>>>> mlcp.bat copy -input_host localhost -input_port 5767 -input_username
>>>> admin -input_password admin ^
>>>> -output_host localhost -output_port 5767 -output_username admin
>>>> -output_password admin ^
>>>> -input_database samplestack-modules ^
>>>> -output_database Documents ^
>>>> -query_filter
>>>> cts:search(doc(),cts:directory-query("/Default/samplestack/rest-api/options/","infinity"))
>>>>
>>>> But am getting error when i execute the above command.
>>>> ERROR mapreduce.MarkLogicInputFormat:
>>>> com.marklogic.xcc.exceptions.XQueryException: XDMP-DOCROOTTEXT:
>>>> xdmp:unquote("cts:search(doc(),cts:directory-query(/Default/samplestack/rest-a...")
>>>> -- Invalid root text
>>>> "cts:search(doc(),cts:directory-query(/Default/samplestack/rest-api/options/,infinity))"
>>>> at  line 1
>>>>  [Session: user=admin, cb=samplestack-modules [ContentSource:
>>>> user=admin, cb=samplestack-modules
>>>>
>>>>
>>>> How can I pass a query in command line to select matching documents?
>>>>
>>>> Thanks,
>>>> Prasanth
>>>>
>>>> _______________________________________________
>>>> General mailing list
>>>> General at developer.marklogic.com
>>>> Manage your subscription at:
>>>> http://developer.marklogic.com/mailman/listinfo/general
>>>>
>>>>
>>>
>>> _______________________________________________
>>> General mailing list
>>> General at developer.marklogic.com
>>> Manage your subscription at:
>>> http://developer.marklogic.com/mailman/listinfo/general
>>>
>>>
>>
>> _______________________________________________
>> General mailing list
>> General at developer.marklogic.com
>> Manage your subscription at:
>> http://developer.marklogic.com/mailman/listinfo/general
>>
>>
>
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> Manage your subscription at:
> http://developer.marklogic.com/mailman/listinfo/general
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20160126/dfd980de/attachment.html 


More information about the General mailing list