You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by ChadDavis <ch...@gmail.com> on 2010/07/17 21:18:18 UTC

xpath query question

I'm not having success implementing an xpath that can do the
following.  I'm implementing a CMS.  Let's say that I have some node
types of my:document and my:folder.  Here are the contents of a given
folder:

+chadsFolder(my:folder)

    -docOne(my:document)
    -docTwo(my:document)        //has a binary child node, of the
nt:file variety, as per the specification

    +innerFolder(my:folder)
          -docThree(my:document)

I do NOT want my search to be recursive.  And I want it to be a full
text search that will hit any of the direct child documents of
"chadsFolder", as well as any binaries associated with them, but not
anything inside of nested folders.

Currently, I build two separate queries and then combine their results
at a higher level.  Here are my two xpath queries.

A)  /jcr:root/chadsFolder/element(*,my:document)[jcr:contains(.,'searchTerm')]

B)  /jcr:root/chadsFolder/element(*,my:document)//element(*,nt:resource)[jcr:contains(.,'searchTerm')]

Query A hit's my documents, query B hits the binaries attached to
those documents.  Is there anything in XPath, that's implemented in
Jackrabbit 2.1, that would allow me to combine these two queries?

Re: xpath query question

Posted by Ard Schrijvers <a....@onehippo.com>.
Hello,

take a look at

http://wiki.apache.org/jackrabbit/IndexingConfiguration

Specifically at the aggregates. That should give you enough pointers I think

Regards Ard

On Sat, Jul 17, 2010 at 9:18 PM, ChadDavis <ch...@gmail.com> wrote:
> I'm not having success implementing an xpath that can do the
> following.  I'm implementing a CMS.  Let's say that I have some node
> types of my:document and my:folder.  Here are the contents of a given
> folder:
>
> +chadsFolder(my:folder)
>
>    -docOne(my:document)
>    -docTwo(my:document)        //has a binary child node, of the
> nt:file variety, as per the specification
>
>    +innerFolder(my:folder)
>          -docThree(my:document)
>
> I do NOT want my search to be recursive.  And I want it to be a full
> text search that will hit any of the direct child documents of
> "chadsFolder", as well as any binaries associated with them, but not
> anything inside of nested folders.
>
> Currently, I build two separate queries and then combine their results
> at a higher level.  Here are my two xpath queries.
>
> A)  /jcr:root/chadsFolder/element(*,my:document)[jcr:contains(.,'searchTerm')]
>
> B)  /jcr:root/chadsFolder/element(*,my:document)//element(*,nt:resource)[jcr:contains(.,'searchTerm')]
>
> Query A hit's my documents, query B hits the binaries attached to
> those documents.  Is there anything in XPath, that's implemented in
> Jackrabbit 2.1, that would allow me to combine these two queries?
>