Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid Value Operator '<'(less than)sign when passed as -query_filter in MLCP

I am using MLCP(Marklogic Content Pump) for copying content from one database to another. In this i'm using -query_filter option and its value is a cts:query in XML serialized format of a set of cts:element-range-query wrapped in cts:and-query :

<cts:and-query xmlns:cts="http://marklogic.com/cts">
  <cts:element-range-query operator=">">
    <cts:element xmlns:c="http://iddn.icis.com/ns/core">c:released-on</cts:element>
    <cts:value xsi:type="xs:dateTime" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">2000-12-21T00:00:00Z</cts:value>
  </cts:element-range-query>
  <cts:element-range-query operator="&lt;">
    <cts:element xmlns:c="http://iddn.icis.com/ns/core">c:released-on</cts:element>
    <cts:value xsi:type="xs:dateTime" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">2016-12-21T00:00:00Z</cts:value>
  </cts:element-range-query>
</cts:and-query>

Now, the above query returns valid result when executed on ML Qconsole, but when passed in -query_filter option of MLCP, it gives the error saying 'Invalid attribute value character '<' .

The version of Marklogic and MLCP is 8.0-5.

On further digging into this I observed that the issue is only when the operator value is less than '<'

Note: I have configured a valid range-index on the database for the element "released-on".

like image 374
Rachit Rampal Avatar asked Jul 06 '16 07:07

Rachit Rampal


1 Answers

MarkLogic encourages the use of options files when using a cts query serialized as XML, because special characters can be interpreted by the underlying OS on the command line.

My first guess would be to try creating a file, say, options.txt with the content:

--query_filter
<cts:and-query xmlns:cts="http://marklogic.com/cts">
  <cts:element-range-query operator=">">
    <cts:element xmlns:c="http://iddn.icis.com/ns/core">c:released-on</cts:element>
    <cts:value xsi:type="xs:dateTime" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">2000-12-21T00:00:00Z</cts:value>
  </cts:element-range-query>
  <cts:element-range-query operator="&lt;">
    <cts:element xmlns:c="http://iddn.icis.com/ns/core">c:released-on</cts:element>
    <cts:value xsi:type="xs:dateTime" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">2016-12-21T00:00:00Z</cts:value>
  </cts:element-range-query>
</cts:and-query>

(You may have to make all the XML fit on the same line of that file though)

and then invoke MLCP with

mlcp.sh -options_file options.txt ...

like image 51
Ghislain Fourny Avatar answered Oct 16 '22 05:10

Ghislain Fourny