jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Klimetschek <aklim...@day.com>
Subject Re: Tricky query
Date Tue, 03 Feb 2009 15:42:58 GMT
On Mon, Feb 2, 2009 at 10:19 PM, Vidar Ramdal <vidar@idium.no> wrote:
> I'm trying to execute a full-text XPath query (using jcr:contains).
> The problem is, I don't want to return the matching node, but an
> ancestor.

You can configure the index to aggregate the fulltext index of
subnodes for certain node types. See
http://wiki.apache.org/jackrabbit/IndexingConfiguration

It will probably look something like that:

<aggregate primaryType="my:Page">
    <include>*</include>
    <include>*/*</include>
    <include>*/*/*</include>
</aggregate>

This way, a jcr:contains() on my:Page nodes will also include the
fulltext data from the subnodes. There is no unlimited recursion
include paramter, so you'll might have to add some longer */*/*
chains, depending on how deep your subtree can be.

> So far, I've tried variations of this query:
> "/jcr:root/some/path//*[@sling:resourceType='page' and
> //*[jcr:contains(.//*, '" + term + "')]]
>  ... but I generally get error messages telling me that the XPath
> feature I want is not supported.

The //*[jcr:contains(....)] in the predicate does not work, as JCR's
xpath does not support sub-axis checks in predicates.

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Mime
View raw message