You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Steven Huey <St...@sparta.com> on 2007/01/02 19:26:57 UTC
Search on Multiple Value Properties
I tried searching the archives and wiki but couldn't find any
examples of XPath or SQL queries for searching the contents of
multiple-value string properties. I have a set of nodes, each with a
property that can contain multiple string values and I'd like to be
able to quickly find all the nodes that have a given string as one of
their values.
Thanks,
Steve
--
Steven Huey
Steven.Huey@sparta.com
Re: Search on Multiple Value Properties
Posted by Marcel Reutegger <ma...@gmx.net>.
Steven Huey wrote:
> I tried searching the archives and wiki but couldn't find any examples
> of XPath or SQL queries for searching the contents of multiple-value
> string properties. I have a set of nodes, each with a property that can
> contain multiple string values and I'd like to be able to quickly find
> all the nodes that have a given string as one of their values.
See the JSR 170 specification sections:
- 6.4.2.5 Multi-value Properties
- 6.6.4.10 Searching Multi-value Properties
Searching for multi-valued properties is basically the same as searching for
single-valued properties.
//*[@foo = 'bar']
will return all nodes with a property called foo and a value 'bar'. Both single-
and multi-valued matches are returned. The = is called a general comparison.
If you are only interested in nodes with a single value for property foo:
//*[@foo eq 'bar']
will return all nodes with a property foo and a single value 'bar'. E.g. nodes
with a multi-valued property foo and values {'foo', 'bar'} will not be returned.
But the query will still return matches for multi-valued properties if foo
just contains the one value {'bar'}. The eq operator is called a value comparison.
In most cases you should be ok with the general comparison operator.
regards
marcel