jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Nuescheler" <david.nuesche...@gmail.com>
Subject Re: count of nodes?
Date Thu, 19 Apr 2007 06:51:45 GMT
Hi Joe,

I think the lack of count is probably not the issue, since I think
you could use the .getSize() on the ResultSet.getNodes() iterator,
right?

I think the one thing that you would need to do is resolve the
UUID to a path using Session.getNodeByUUID(uuid).getPath()
and then pass something like

/jcr:root/<path>//*

or

SELECT * FROM nt:base WHERE jcr:path LIKE '/<path>/%'

...and then call the said .getSize().

does that make sense?

regards,
david

On 4/18/07, Ottinger, Joseph <jottinger@techtarget.com> wrote:
> Hi. I'm trying to get a count of nodes under a specific node. To
> explain, imagine the following tree:
>
> <foo>
>     <bar>
>         <baz />
>     </bar>
> </foo>
>
> Given a path to /foo (via UUID), what I want to do is get a count
> including both <bar> and <baz> -- i.e., I want to get a result of "2".
>
> Using XPath, the query should be something like -- pardon me my horrible
> syntax, k? --
>
> count(//*[jcr:uuid=$uuid]/*)
>
> However, count() is unsupported. So I'm kinda stuck, unless I want to
> walk the tree under /foo, and I don't unless I have no choice.
>
> Any suggestions?
>

Mime
View raw message