3

How can we do case insensitive search for path range queries? I want to make case insensitive search for path:

/pathSyntax = (case insensitive value of $Type)

Sample Query Format for Path range search , I need to make this path range query search as case insensitive :, do I need to make changes in Indexes also created for it?

let $xyz:= cts:and-query((
 cts:collection-query(concat("xyz://", val, "/test")),
 cts:path-range-query("/pathSyntax", "=",$Type)
))

Below is range path index :

{
  "scalar-type": "string",
  "path-expression": "/pathSyntax",
  "collation": "http://marklogic.com/collation/",
  "range-value-positions": false,
  "invalid-values": "reject"
},
Mads Hansen
  • 63,927
  • 12
  • 112
  • 147
user1575601
  • 397
  • 1
  • 7
  • 20

1 Answers1

3

You could index your path with a collation that is case-insensitive.

For instance, http://marklogic.com/collation/en/S1 is a case/diacritic insensitive English character encoding, or http://marklogic.com/collation/en/S2 which is diacritic sensitive and may perform better.

{
  "scalar-type": "string",
  "path-expression": "/pathSyntax",
  "collation": "http://marklogic.com/collation/en/S1",
  "range-value-positions": false,
  "invalid-values": "reject"
}

Depending upon the default collation of your query, you may also need to specify the collation as an option in your cts:path-range-query:

cts:path-range-query("/pathSyntax", "=", $Type, "collation=http://marklogic.com/collation/en/S1")
Mads Hansen
  • 63,927
  • 12
  • 112
  • 147