You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Torgeir Veimo <to...@pobox.com> on 2006/02/21 09:19:18 UTC

best practice - node view count

Has anyone implemented view counting for nodes in a jcr setup? 

I'd assume it would hurt performance to store view count as a node
property.

-- 
Torgeir Veimo <to...@pobox.com>


Re: best practice - node view count

Posted by David Nuescheler <da...@gmail.com>.
hi togeir,

> Nice, I didn't know. Thx.
> Is it possible to control how this counter is incremented as well?
> A node can be read many times when the content is not really read by a
> person, eg by a content admin system redering a list of documents.

the STATS_NODE_COUNT_PROPERTY indicates how many nodes
"exist" in a content repository and is a questionable and rough size
indication of the content stored in the content repository. this
counter doesn't really serve a real purpose other than being
"interesting" ;).

i think what you are looking for is a "per node" view counter, which
is a different story.

regards,
david

Re: best practice - node view count

Posted by Torgeir Veimo <to...@pobox.com>.
On Tue, 2006-02-21 at 11:39 +0100, Tobias Bocanegra wrote:
> hi torgeir,
> there is a descriptor that provides you with this information:
> 
> RepositoryImpl
> .
> .
>     // names of well-known repository properties
>     public static final String STATS_NODE_COUNT_PROPERTY =
> "jcr.repository.stats.nodes.count";
>     public static final String STATS_PROP_COUNT_PROPERTY =
> "jcr.repository.stats.properties.count";
> .
> .
> so just call: repository.getDescriptor("jcr.repository.stats.nodes.count");

Nice, I didn't know. Thx.

Is it possible to control how this counter is incremented as well?

A node can be read many times when the content is not really read by a
person, eg by a content admin system redering a list of documents.

-- 
Torgeir Veimo <to...@pobox.com>


Re: best practice - node view count

Posted by Tobias Bocanegra <to...@day.com>.
hi torgeir,
there is a descriptor that provides you with this information:

RepositoryImpl
.
.
    // names of well-known repository properties
    public static final String STATS_NODE_COUNT_PROPERTY =
"jcr.repository.stats.nodes.count";
    public static final String STATS_PROP_COUNT_PROPERTY =
"jcr.repository.stats.properties.count";
.
.
so just call: repository.getDescriptor("jcr.repository.stats.nodes.count");


regards, toby

On 2/21/06, Torgeir Veimo <to...@pobox.com> wrote:
> Has anyone implemented view counting for nodes in a jcr setup?
>
> I'd assume it would hurt performance to store view count as a node
> property.
>
> --
> Torgeir Veimo <to...@pobox.com>
>
>


--
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---

Re: best practice - node view count

Posted by David Nuescheler <da...@gmail.com>.
hi togeir,

if i understand you correctly you are looking to store how many times
a particular node is "displayed" in an application.

personally, i think this is an application specific feature that since
semantically the definition of "view" or "display" is not identical
with the actual numer of times that the getNode() or similar is called.

i would suggest to implement it as a mixin "myapp:Countable"
or something and increment the "counter" property whenever
the respective event occurs.

of course this generates a bit of overhead since the repository
will fire observation events or re-index the modified content.
but then again this may exactly be what you want, to generate
something like a 10-ten most frequently view nodes...

regards,
david