jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Gaeremynck <gaeremyn...@gmail.com>
Subject Query contains question
Date Wed, 11 Aug 2010 12:40:55 GMT
Hi all,

I'm struggling a bit with the jcr:contains() function for xpath.

I have the following nodes
+ foo
   -  name = 'Anne-Sophie'
+ bar
   -  name = 'Anne-Suzy'

Now, I want to do a query that gets both when I type in 'Anne-S'
I can't use jcr:like because I need to match any property, and not the @name one specifically.

I thought the following would do, but it doesn't:
//*[jcr:contains(., 'Anne-S*)

According to the spec you have to escape the - character if you do not want it to be interpreted
as a negator. (
//*[jcr:contains(., 'Anne\\-S*)

That doesn't match them either.

The following two do match them (a space between the - and the S)
//*[jcr:contains(., 'Anne- S*)
//*[jcr:contains(., 'Anne\\- S*)

But these would also match a name 'Anne- Soekie' (note the space between the - and the S.)

Am I doing something wrong? Is this a bug, or is it intended this way?

Kind regards,
View raw message