You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@roller.apache.org by ev...@yahoo.com on 2007/08/03 19:42:32 UTC

How to get total number of records in specific category?

Hello,
I need to have total number of records from specific category.
I can use :
getRecentWeblogEntries("/MyCategory", 9999).size()
Is it the right way?

Thanks
Gene

Re: How to get total number of records in specific category?

Posted by Dave <sn...@gmail.com>.
On 8/3/07, evgeniy.strokin@yahoo.com <ev...@yahoo.com> wrote:
> I need to have total number of records from specific category.
> I can use :
> getRecentWeblogEntries("/MyCategory", 9999).size()
> Is it the right way?

That doesn't seem like an efficient way to implement a # entries in
category count. Unfortunately, doing it right will require a Java code
change.

The right way is probably to add a method to WeblogManager, something like this:
   WeblogManager.getEntryCount(WeblogCategory cat, boolean recursive)

Then you'd need to expose that to templates, which you could do via
the Weblog object.
   Weblog.getEntryCount(WeblogCategory cat, boolean recursive)

You'd also need to add that same method to the WeblogWrapper.

If you are really interested file a patch, or at least an RFE in JIRA.
Somebody else might pick it up.

- Dave

Re: How to get total number of records in specific category?

Posted by Dave <sn...@gmail.com>.
On 8/3/07, evgeniy.strokin@yahoo.com <ev...@yahoo.com> wrote:
> I need to have total number of records from specific category.
> I can use :
> getRecentWeblogEntries("/MyCategory", 9999).size()
> Is it the right way?

That doesn't seem like an efficient way to implement a # entries in
category count. Unfortunately, doing it right will require a Java code
change.

The right way is probably to add a method to WeblogManager, something like this:
   WeblogManager.getEntryCount(WeblogCategory cat, boolean recursive)

Then you'd need to expose that to templates, which you could do via
the Weblog object.
   Weblog.getEntryCount(WeblogCategory cat, boolean recursive)

You'd also need to add that same method to the WeblogWrapper.

If you are really interested file a patch, or at least an RFE in JIRA.
Somebody else might pick it up.

- Dave