jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ottinger, Joseph" <jottin...@techtarget.com>
Subject RE: count of nodes?
Date Thu, 19 Apr 2007 12:50:00 GMT
But wouldn't getSize() on the getNodes() call only get the immediate
child nodes?

I'll keep investigating - I still find the Xpath rules a problem. :/ 

-----Original Message-----
From: David Nuescheler [mailto:david.nuescheler@gmail.com] 
Sent: Thursday, April 19, 2007 2:52 AM
To: users@jackrabbit.apache.org
Subject: Re: count of nodes?

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