jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torgeir Veimo <torg...@netenviron.com>
Subject jcr:contains query issues
Date Wed, 28 Mar 2012 12:46:05 GMT
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. Instead I can use

//element(*, nt:base)[jcr:contains(@tagproperty, 'tag1') or
jcr:contains(@tagproperty, 'tag2') or jcr:contains(@tagproperty,
'tag3')] order by @jcr:score

but the query string can potentially become very large.

Additionally, I'm also trying to include nodes that doesn't match any
of the tags, but just sort them such that they end up below the
matching nodes. This requires an additional 'dummy match', but I'm
having trouble letting this dummy match have a lower boost than the
jcr:contains, even when I boost the contains, (all nodes have a name
property):

//element(*, nt:base)[(jcr:contains(@tagproperty, 'tag1^10') or
jcr:contains(@tagproperty, 'tag^10') or jcr:contains(@tagproperty,
'tag3^10') or @name)] order by @jcr:score

Is there a better way of doing this?

-- 
-Tor

Mime
View raw message