jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Kennedy <da...@us.ibm.com>
Subject union queries
Date Fri, 28 Apr 2006 14:09:43 GMT
It appears that xpath union queries are not supported, but it also appears 
as though this cannot be accomplished by SQL either.  I get exceptions 
stating an invalid path clause.  My queries look like this:


(s1)      statement = "/jcr:root/a/b/c/d union /jcr:root/a/e/f"
s1 will execute without exception, however will return 0 hits, but the 
nodes exist in the repository.  Is xpath union supported with the 
jackrabbit implementation?

(s2)      statement = "SELECT * FROM nt:base WHERE jcr:path = 
'/jcr:root/a/b/c/d' OR jcr:path = '/jcr:root/a/e/f'"
s2 will fail with javax.jcr.query.InvalidQueryException: Invalid 
combination of jcr:path clauses which results from an 
IllegalArgumentException because there is no merging path (%).  Why is a 
merging path necessary if I am using '='? 

(s3)      statement = "SELECT * FROM nt:base WHERE jcr:path LIKE 
'/jcr:root/a/b/c/d' OR jcr:path LIKE '/jcr:root/a/e/f'"
s2 will fail with javax.jcr.query.InvalidQueryException: Invalid 
combination of jcr:path clauses which results from an 
IllegalArgumentException because there is no merging path (%). 

(s4)      statement = "SELECT * FROM nt:base WHERE jcr:path = 
'/jcr:root/a/b/c/d' OR jcr:path LIKE '/jcr:root/a/e/f/%'"
s2 will fail with javax.jcr.query.InvalidQueryException: Invalid 
combination of jcr:path clauses which results from an 
NoSuchElementException because the two specified paths are not sharing the 
same path.  Similar failure if I use LIKE for both and wildcard both paths 
(/%).

Why don't any of these work?  Is xpath union expected to be supported?  I 
can accomplish these by executing 2 queries, but I was hoping for 
something more efficient that doesn't require 2 roundtrips to the DB.

David






Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message