You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Marcel Reutegger <ma...@gmx.net> on 2008/07/01 09:56:47 UTC

Re: XPath expression leeds to NPE in QueryParser

ThorstenL wrote:
>  I'm currently trying with to write my first non trivial queries with XPath.
> So I'm not too sure, if I misunderstand something completely wrong, or
> if there is something broken.
> 
>  This is my current candidates:
> 
> //*[@jcr:primaryType='nt:file'][*//text()[jcr:like(.,'%Dokument%')]]

would the following work for you?

//element(*, nt:file)[jcr:contains(jcr:content, 'Dokument')]

it assumes that your files have an nt:resource child node named jcr:content.

remarks:
- element(*, nt:file) also returns node with a subtype of nt:file
- jcr:contains() is more efficient than jcr:like for longer strings and you
   actually want to do a fulltext search

regards
  marcel