jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sébastien Launay <sebastien.lau...@anyware-tech.com>
Subject Re: Counting occurences of a given property's different values
Date Thu, 05 Feb 2009 16:29:34 GMT
gregoryjoseph a écrit :
> Thanks for the hint; however, I still don't know what any of the values are.
> My initial fake query might have been misleading because of the
> prop_name='foo' clause, might have been clearer with prop_name='tag'. In
> short, I know the property *name* I'm looking for, and I want to collect all
> its existing *values* over a set of nodes in my tree.
>   
Hi Gregory,

Because you want to browse tags, you might want to change your model by:
- creating a branch with the tags (/jcr:root/tags/foo)
- references these tags in your node by using a path property or
  a reference property.

Reference property allow you to count references and then simply use:
node.getReferences().getSize()
on the tag node to get its sizes.

But, references comes with somes constraints [1].

The "query" will just be :
List<Pair<String, Integer>> tagCloud = new ArrayList()
for (Node node : tagsNode.getNodes())
  tagCloud.add(new Pair(node.getName(), node.getReferences().getSize())

[1]
http://wiki.apache.org/jackrabbit/DavidsModel#head-ed794ec9f4f716b3e53548be6dd91b23e5dd3f3a

--
Sébastien Launay

Mime
View raw message