Description
With OAK-4265, we now have ability to have ORed xpath statement. Following xpath:
(/jcr:root/a//* | /jcr:root/b//* | /jcr:root/c//*) order by @jcr:score
gets transformed as
select [jcr:path], [jcr:score], * from [nt:base] as a where isdescendantnode(a, '/a') /* xpath: /jcr:root/a//* order by @jcr:score */ union select [jcr:path], [jcr:score], * from [nt:base] as a where isdescendantnode(a, '/b') /* xpath: /jcr:root/b//* order by @jcr:score */ order by [jcr:score] union select [jcr:path], [jcr:score], * from [nt:base] as a where isdescendantnode(a, '/c') /* xpath: /jcr:root/c//* order by @jcr:score */ order by [jcr:score]
That SQL, although throws parse exception:
java.text.ParseException: Query: select [jcr:path], [jcr:score], * from [nt:base] as a where isdescendantnode(a, '/a') /* xpath: /jcr:root/a//* order by @jcr:score */ union select [jcr:path], [jcr:score], * from [nt:base] as a where isdescendantnode(a, '/b') /* xpath: /jcr:root/b//* order by @jcr:score */ order by [jcr:score] union(*)select [jcr:path], [jcr:score], * from [nt:base] as a where isdescendantnode(a, '/c') /* xpath: /jcr:root/c//* order by @jcr:score */ order by [jcr:score]; expected: <end>
A test statement that fails (to be put in XPathTest):
verify("(/jcr:root/a//* | /jcr:root/b//* | /jcr:root/c//*) order by @jcr:score", "select [jcr:path], [jcr:score], *\n" + "from [nt:base] as a\n" + "where isdescendantnode(a, '/a')\n" + "/* xpath: /jcr:root/a//* \n" + "order by @jcr:score */\n" + "union select [jcr:path], [jcr:score], *\n" + "from [nt:base] as a\n" + "where isdescendantnode(a, '/b')\n" + "/* xpath: /jcr:root/b//* \n" + "order by @jcr:score */\n" + "order by [jcr:score]\n" + "union select [jcr:path], [jcr:score], *\n" + "from [nt:base] as a\n" + "where isdescendantnode(a, '/c')\n" + "/* xpath: /jcr:root/c//*\n" + "order by @jcr:score */\n" + "order by [jcr:score]");
Attachments
Issue Links
- relates to
-
OAK-4265 XPath: support limited form of "union"
- Closed