- Powered by Domino 8.5.2 Domino Accelerator Pack
- GoFaster=1
Lotus Triple Search DominoExperts + Blogs + R8 forum -> General Domino Talk

 Counting documents from many views and displaying the result?

Joacim BoivePost date: 2007-05-22 19:02

I have a forum and the client wishes that the doc count should be visible in the forum index, where all the different areas are listed.

That would mean retriving the view for each, get a coll.count, and return it. Not a very good idea...

Maybe a profiledocument that get's updated each time a user creates a document? Hmmm... But then there's chance of save/replication conflicts.


Servlet maybe? Haven't strayed much in to this area yet.





Tomas NielsenPost date: 2007-05-25 20:16

I am not sure how many forums you have but could you do a script src that calls an openagent and have that agent return the count for that forum?

Joacim BoivePost date: 2007-05-27 10:47

"That would mean retriving the view for each, get a coll.count, and return it. Not a very good idea..."



The problem isn't to get the info, it's to do it in the most efficent way.




Tomas NielsenPost date: 2007-05-27 12:10

Yes, it depends on the need for performance/time you can spend developing.

But if you go with the profile solution it must be possible to do save(false,false) and have a scheduled agent readjusting the numbers every night in case there was an update that was missed. I do something similar in this forum for the post counts and last updaters.

Is the solution a heavy traffic database? The servlet solution, although fun to develop, seem a little overkill? 

But if you go with the servlet you could have a separate thread that read up the coll.count every 5-30 minutes and save the result in memory for fast delivery when the servlet is called.

Servlets that do no disk access respond so fast that you can not measure the execution time using the internal Java timer.

Daniel LehtihetPost date: 2007-05-27 22:07

How about creating a special view that displays your different sub-forums as categories. That way, you can easily use ?readviewentries and fetch the "children" attribute:


- <viewentries toplevelentries="2">
- <viewentry position="1" noteid="80000004" children="4" descendants="5" siblings="2">
- <entrydata columnnumber="0" name="key" category="true">
if you really want an up-to-date snapshot that is...

Fredrik StöckelPost date: 2007-05-28 23:03

The readviewentries approach sounds like a flexible and doable solution. A Similar approach to Daniels suggestion is to include all forum-docs into one "index view"  and build a simple js array containing the count for each forum in the view.

"forumIndex[\"" + forumName + "\"] = " + @DocDescendants + ";"

"Threat content as html" should be enabled and the view can be embedded in a page or similar (content-type:text/javascript" and added to the forum-index page as a regular javascript include. This is very fast.





Joacim BoivePost date: 2007-06-01 10:21



Both ideas are good, but I prefer the minimalistic approach so I'll go for Fredriks approach. Very simple, why didn't I think of that? :)


Thanks Guys!



RSS feed
Subscribe to Forum

Share this page

Top posters
Tomas Nielsen212
Joacim Boive27
Fredrik Stöckel27
Niklas Waller13
Kenneth Haggman11
Bryan Kuhn10
Daniel Lehtihet9
Jonas Israelsson8