You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Stephen Kruger <st...@yahoo.com> on 2012/01/28 20:05:42 UTC

Unable to find a way to efficiently sort by child size ?

Hi,

I'm struggling to write a query to return me the node which has the largest amount of children.

For example given : 

root
-A
--a1
--a2
--a3
-B
--b1
--b2
-C
--c1

it should return A (potentially followed by B and then C, but I'm only really interested in A).

My current code simply iterates through the Level 1 nodes A,B,C etc and for each one run a "//* order by xxx" and gets the getRows().getSize().

However the performance of this is obviously quite bad, but I'm unable to find anything like "//* order by jcr:childcount"

Does anyone have any insights into an efficient way to do this? I'm happy to use JQOM if that might be easier.

regards