jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Klimetschek <aklim...@day.com>
Subject Re: Query mixin properties but also pull back nt:file information
Date Tue, 15 Sep 2009 07:15:41 GMT
On Mon, Sep 14, 2009 at 21:15, Michael Shoener
<mshoener@softwareapps.net> wrote:
> Is there any way to query my custom mixin (hfs:file) and still be able to
> pull back the default jcr:content information?
>
> The default query (which searches the entire node contents and all
> properties):
>
>        //element(*, nt:file)[jcr:contains(jcr:content, 'text to
> query')]/rep:excerpt(.)
>
> The query I am using (which searches only the @hfs:description and
> @hfs:formname priperties):
>
>        //element(*, hfs:file)[jcr:contains(@hfs:description, 'text to
> query') or jcr:contains(@hfs:formname, 'text to query')]/(@hfs:description |
> @hfs:formname)
>
> I also want to be able to search on jcr:content and return the same
> information that the default search returns, plus my @hfs:description and
> @hfs:fromname values, if possible.

Do you mean you want to get both the excerpt (the rep:excerpt() in
your default query) and the single properties you mention?

In this case you simply run

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

use the row iterator in the results and fetch both the properties via
row.getValue("hfs:description") and the excerpt via
row.getValue("rep:excerpt(.)"). The rep:excerpt function can be used
in both places - in the query and on the result set.

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Mime
View raw message