[xquery-talk] restricting search to different nodes

Wolfgang Meier wolfgang at exist-db.org
Thu Jan 5 11:16:13 PST 2006


Hi Peter,

> I am using the open source native xml database eXist which offers
> index-based full text search.
> 
> My question is whether I can combine for instance the following two queries
> into one or if I have to perform to queries and then merge the results?
> 
> for $doc in //text/body/abstract &= 'searchTerm' 
> return $doc/../..
> 
> for $doc in //text/body/metadata1 &= 'searchTerm' 
> return $doc/../..

The non-standard '&=' can be used like the standard '='. To query two 
node sets, you may simply create a union. For example:

for $doc in //text/body/(abstract | metadata1)[. &= 'searchTerm']

Wolfgang



More information about the talk mailing list