You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Alexander Klimetschek <ak...@adobe.com> on 2012/06/05 20:57:40 UTC

Re: jcr:contains query issues

On 28.03.2012, at 05:46, Torgeir Veimo wrote:

> I'm trying to query (using xpath xyntax) for a number of nodes with
> sorting based on how many tags on each node matches a set of tags.
> 
> I'm currently trying to do this using
> 
> //element(*, nt:base)[jcr:contains(@tagproperty, 'tag1 tag2 tag3')]
> order by @jcr:score
> 
> but it doesn't work very well.

If you use a multi-value property, you can do:

//*[@tagproperty = "tag1" or @tagproperty = "tag2" or @tagproperty = "tag3"]

For multi-value properties, the operator "=" matches if at least one value matches.

I think the first terms get a higher score. Not sure how to handle your dummy match score though.

Cheers,
Alex