3

I have a xml documents in MarkLogic,

Document 1 - URI - /test1/wf1

<?xml  version="1.0" encoding="UTF-8"?>
<workflow>
    <workflowName>Oracle_RMS_9_RMS_9_Pos_and_Allocations_WF</workflowName>
    <workflowDescription>
    </workflowDescription>
    <endPointName>Oracle RMS 9_RMS 9 Pos and Allocations</endPointName>
    <createdDttm>2019-06-11 00:21:26.2121Z</createdDttm>
    <modifiedDttm>2019-08-28T04:37:19.764Z</modifiedDttm>
</workflow>

My requirement is to get the document uris only if element value matches with ignore case.

cts:uris((),(),cts:and-query((cts:collection-query("workflow"),cts:element-value-query(xs:QName("endPointName"),"Oracle RMS 9 RMS 9 POs and Allocations",("case-insensitive","whitespace-sensitive")))))

I am executing above query to get the document URI matching value with xs:QName("endPointName") here I am expecting empty sequence because there is no matching document but I am getting /test/wf1 as query result.

Please guide me to fix this issue.

DevNinja
  • 1,459
  • 7
  • 10

2 Answers2

0

Have you tried using "exact" option in the query with case-insensitive", "whitespace-sensitive. This might resolve the issue.

Hope this helps.

Regards.

Ishaan S
  • 51
  • 4
  • Documentation can be found here : https://docs.marklogic.com/cts:word-query – Ishaan S Sep 19 '19 at 12:35
  • Thanks @Ishaan for your response. I already tried using "exact" and i got this error `[1.0-ml] XDMP-INCONSOPTS: cts:element-value-query(fn:QName("","endPointName"), "Oracle RMS 9 RMS 9 POs and Allocations", ("exact", "case-insensitive", "whitespace-sensitive")) -- Inconsistent options exact case-insensitive` – DevNinja Sep 19 '19 at 12:42
  • "exact" will be case-sensitive so this will not fulfill his requirement of ignoring case. – Rob S. Sep 19 '19 at 13:11
  • Also, he's using element-value-query not element-word-query – Rob S. Sep 19 '19 at 13:11
  • I think need to think about a way to exclude underscore's then. Thinking about it. – Ishaan S Sep 19 '19 at 22:51
  • Use 'exact' alone. Exact is shorthand for "case-sensitive", "diacritic-sensitive", "punctuation-sensitive", "whitespace-sensitive", "unstemmed", and "unwildcarded". Also see: https://help.marklogic.com/Knowledgebase/Article/View/476/0/understanding-search-value-queries – asusu Oct 16 '19 at 15:29
0

From the documentation on cts:element-value-query :

If neither "punctuation-sensitive" nor "punctuation-insensitive" is present, $text is used to determine punctuation sensitivity. If $text contains no punctuation, it specifies "punctuation-insensitive". If $text contains punctuation, it specifies "punctuation-sensitive".

I expect you need to specify the option "punctuation-sensitive" since there is no punctuation in your search string.

Rob S.
  • 3,599
  • 6
  • 30
  • 39
  • Thanks for your response, i added `punctuation-sensitive` but still i am getting same behavior. now my options are `("punctuation-insensitive", "case-insensitive","whitespace-sensitive")`. – DevNinja Sep 19 '19 at 16:35
  • @ShivlingBhandare Try going whitespace-insensitive. Perhaps that's tripping you up – Rob S. Sep 19 '19 at 18:07
  • thanks for your response, I tried but still getting same result. – DevNinja Sep 20 '19 at 03:00
  • @ShivlingBhandare, you speak of `("punctuation-insensitive", "case-insensitive", "whitespace-sensitive")` in your first comment, but that is the wrong punctuation option. You really need punctuation-sensitive, case-insensitive, and whitespace-sensitive here. As alternative, you could use a range index with a collation that ignores case. – grtjn Sep 20 '19 at 08:02
  • @grtjn, Can you please give sample snippet using range index with a collation which will fulfill my requirement. – DevNinja Sep 20 '19 at 09:49
  • You'd need an element range index on the element `endPointName` of type `string` with collation `http://marklogic.com/collation//S1` or `http://marklogic.com/collation//S2`. Use the `collation builder` button when adding the index to understand what options there are. – grtjn Sep 20 '19 at 10:11