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: XPath difference in queries
Date Wed, 20 Jun 2007 13:59:48 GMT
Amir Mistric wrote:
> Q1: //*[@jcr:primaryType='mgnl:content']//*[jcr:contains(.,'term1') and jcr:contains(.,
'term2')]

returns all node that contain 'term1' and 'term2' in one of its properties and 
are a descendant of a node with primary type mgnl:content.

> Q2: //*[@jcr:primaryType='mgnl:content' and jcr:contains(.,'term1') and jcr:contains(.,'term2')]

returns all node with a primary type mgnl:content that contain 'term1' and 
'term2' in one of its properties

> Q3: //element(*,nt:base)[@jcr:primaryType='mgnl:content' and jcr:contains(.,'term1')
and jcr:contains(.,'term2')]

same as Q2

> Basically all I want is to extract all the nodes of primary type "mgnl:content" and then
to search them for the query terms which are ANDed.

that's:

//*[@jcr:primaryType = 'mgnl:content' and jcr:contains(., 'term1 term2')]

or if you are also interested in nodes, which are sub types of mgnl:content:

//element(*, mgnl:content)[jcr:contains(., 'term1 term2')]

regards
  marcel

Mime
View raw message