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: contains search starting from specific node?
Date Thu, 26 Apr 2007 07:23:28 GMT
Hi Philipp,

Phillip Rhodes wrote:
> I am trying to do a contains xpath search, and restrict the search to a node
> (and it's children).
> Doing this search works, but does not require results to be in the "myfolder"
> node //*[jcr:contains(.,'test')]
> The above search returns a node that I have added and the node.getPath()
> function returns a value of: /myfolder/a pdf/jcr:content
> This search, while it does not error out, it does not return any results: 
> //myfolder/*[jcr:contains(.,'test')]

this is because the jcr:contains matches the nt:resource node (the one named 
jcr:content) and the path without the predicate selects the nt:file nodes. thus 
the intersection is always empty.

/jcr:root/myfolder/*[jcr:contains(jcr:content, 'test')]

or if you want to find files in any folder called myfolder, not just under the 
root node:

//myfolder/*[jcr:contains(jcr:content, 'test')]


View raw message