On Mon, Jul 19, 2010 at 17:18, Omid Milani <[email protected]> wrote: > Thanks for the response, but this isn't what I wanted. > I'm trying to get count of something (like tag-references to the node) > for each row of results, or order my result with it. > With calling getSize on iterator, I would have to do n+1 queries > instead of 1, to get the count. and event that wouldn't get the order > right.
Oh, looks like I didn't read your question properly. There is no count(*) or group by selector in JCR SQL [1], XPath [2] or JCR-SQL2/AQM [3]. To implement such a tag cloud, you can run one query that fetches all your content containing the relevant "tag" property: //element(*, my:Article)[...@tag] and then iterate over the result and count your tags on the application side by looking at the tag property values and using some hashmap (tagid -> count). [1] http://www.day.com/specs/jcr/1.0/ (section 8.5) [2] http://www.day.com/specs/jcr/1.0/ (section 6.6) [3] http://www.day.com/specs/jcr/2.0/6_Query.html Regards, Alex -- Alexander Klimetschek [email protected]
