Querying case-insensitive paths with SQL2 ISDESCENDANTNODE in CQ5

1.6k views Asked by At

I have this SQL2 query that searches for nodes that are descendant of a certain path:

SELECT product.* FROM [nt:base] AS product 
INNER JOIN [nt:base] AS variant ON ISCHILDNODE(variant, product) 
  WHERE ISDESCENDANTNODE(product, '/etc/commerce/products/welzijnswinkel/welzijnswinkel/nl/hobby en vrije tijd') 
    AND ISDESCENDANTNODE(variant, '/etc/commerce/products/welzijnswinkel/welzijnswinkel/nl/hobby en vrije tijd') 

Can I write this condition so that the path is case insensitive? For instance, if I have:

ISDESCENDANTNODE(variant, '/etc/commerce/products/welzijnswinkel/welzijnswinkel/nl/Hobby En Vrije Tijd')

Those nodes would still be found under '/etc/commerce/products/welzijnswinkel/welzijnswinkel/nl/hobby en vrije tijd'.

1

There are 1 answers

0
Henrique Ordine On BEST ANSWER

According to the JCR spec, 2 paths are equal when:

  • They contain the same number of segments.
  • Each segment in P1 is equal to the segment at the same position in P2.

And two name segments are equal if and only if their JCR names are equal.

Since 2 JCR names are equal by calling a String.compareTo() method, then they are compared in a case-sensitive manner, and the answer to this question is therefore no, you can't write this condition so that the path is case insensitive.

See 3.4.8 Equality of Paths here: http://www.day.com/specs/jcr/2.0/3_Repository_Model.html