jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Shoener" <mshoe...@softwareapps.net>
Subject RE: Query syntax comparing against multiple property values
Date Mon, 14 Sep 2009 15:20:49 GMT
Thanks I just figured it out before I received this email ;-)

Best Regards,

Michael Shoener
Support Staff
Software Application Services, Inc.

-----Original Message-----
From: Alexander Klimetschek [mailto:aklimets@day.com] 
Sent: Monday, September 14, 2009 11:09 AM
To: users@jackrabbit.apache.org
Subject: Re: Query syntax comparing against multiple property values

On Fri, Sep 11, 2009 at 18:46, Michael Shoener <mshoener@softwareapps.net>
> I am trying to figure out the correct Xpath query for the following 
> query:
>        SELECT hfs:description, hfs:formname FROM hfs:file WHERE 
> 'testing')
> The above query returns all records where either the hfs:description 
> or hfs:formname contains the value "testing".

This will return all nodes that contain 'testing' somewhere (depending on
the text extraction). You have to specify the properties in the contains
method explicitly if you want to search only inside properties and not the
whole node. The properties in the select part are only for
selecting/restricting the result set, they have no influence on the where
clause. In Jackrabbit, the result set will always be nodes.

For xpath, this would look like this:

//element(*, hfs:file)[jcr:contains(@hfs:description, 'testing') or
jcr:contains(@hfs:formname, 'testing')]

The result will contain nodes anyway, so to get those properties you have to
call node.getProperty("hfs:description") or
row.getValue("hfs:description") for each result node/row.


Alexander Klimetschek

View raw message