jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Reutegger <marcel.reuteg...@gmx.net>
Subject Re: SQL Query: Search on childnode and property
Date Mon, 26 Oct 2009 08:46:55 GMT

On Thu, Oct 22, 2009 at 16:02, Bahl Christian <christian.bahl@gwvs.de> wrote:
> Hi,
> i´ve the following sql query:
> SELECT * FROM nt:unstructured WHERE title='any title' AND articleDocument='false' AND
/companyIds/collection-element IS NULL AND /menuIds/collection-element/menuId='1234'
> Now my problem is this part " AND /companyIds/collection-element IS NULL AND /menuIds/collection-element
IS NULL". It shows error in sql query language.
> So my question: is it possible to do search properties on childnodes with sql query language?

no, this is not possible.

> If so, can you please give me some examples?

you should use XPath instead:

//element(*, nt:unstructured)[@title='any title' and @articleDocument
= 'false' and not(companyIds/@collection-element) and
menuIds/collection-element/@menuId = '1234']

notes: JCR does not have null values, so you check for the existence
of a property. paths that start with a slash are absolute (which is
probably not what you want here...).


> Thx
> Christian

View raw message