Search code examples
xpathjackrabbit

Does Jackrabbit support the XPath union (|) operator?


I am trying to search under 2 different nodes for a specific name. This works

/jcr:root/db067409/libraries/bd0b868d/_x0030_//*[@name="FIRST"]

But when I try to OR it with the second node like so...

/jcr:root/db067409/libraries/bd0b868d/_x0030_//*[@name="FIRST"]|/jcr:root/db067409/libraries/_x0033_78d57e4/_x0031_//*[@name="FIRST"]

I no longer get any search results. Please could someone point out what I've done wrong.

What I'd really like to do is along these lines; if I have /a/b/ID1/VERSION1 and /a/b/ID2/VERSION2 I'd like an xpath something like this /a/b/(ID1/VERSION1 or ID2/VERSION2)//*[@name="some name"].


Solution

  • Answer is no. Unfortunately, it doesnt throw an UnsupportedOperationException like you'd expect. There was an item in Jira but I guess they ignored it as Xpath is now deprecated.

    Use JCR_SQL2 if you do need a union.