Hi all,
I'm working again on xpath queries and this time I couldn't get any good
solution. My problem: I'd like to have, in a single result set, all the
first level children (magnolia pages) of two different paths selected by
the user, that matches a condition. The difficult part is that one path
(say path2) may be a child of the other (say path1, so it's path2 =
path1/node), and that child may not even be included in the given condition.
Maybe it's easier with the code: the two queries are like this:

//path1/element(*, mgnl:content)[(not(@hide) or (@hide eq false()))]

//path2/element(*, mgnl:content)[(not(@hide) or (@hide eq false()))]

If you run them individually they work flawlessy and I get the results
I want, but how do I "join" them? There are no "union" nor "in"
capabilities in the xpath, and not even in the sql version of xpath
query. I know there is a | operator, but I didn't get how to use it
correctly, if I just do

(//path1/element(*, mgnl:content)[(not(@hide) or (@hide eq false()))] |
//path2/element(*, mgnl:content)[(not(@hide) or (@hide eq false()))])

it seems like it's doing the intersection of the two node set more that
the union.
I tried a lot of strange combinations out of helplessness, and if you
want to try, this one (just as it is, with the fake paths) crashes not
only jackrabbit but also the freemarker template and the page of the JCR
Queries in adminCentral (maybe it's some bug of version 3.6.3):

(//path1/element(*, mgnl:content) | //path2/element(*,
mgnl:content))[(not(@hide) or (@hide eq false()))]

Any ideas about joining the two result sets in a single query (so I may
even sort them)? My patch solution was simply to do two queries and join
the result sets afterward in a function, but it's not very clear and I
think it's also slower than it should be (expecially when the result is
big).

Thanks in advance, Danilo.



----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to