[Product-Developers] How to search and sort content based on owner last login time?

Dylan Jay djay at pretaweb.com
Mon May 14 00:52:45 UTC 2012

On 14/05/2012, at 10:25 AM, Laurence Rowe wrote:

> Dylan Jay wrote
>> On 14/05/2012, at 4:14 AM, Andreas Jung <lists@> wrote:
>>> Hash: SHA1
>>> Sorry but you don't know what you are doing. You retrieve the  
>>> last_login
>>> time *once* and pass the value to a date range query.
>>> That's it - nothing more, nothing less.
>> He wants to 'sort' on 'owners' last login. Why is a nuts idea and not
>> simple.
>> To do this you could create a new index in the zcatalog but to keep  
>> it
>> up to date you'd need to reindex that index everytime anyone logged  
>> in
>> which would create a lot of writes.
>> Zcatalog is a denormslised query system. You can't do a join.
> ZCatalog is a collection of indexes and metadata, so I don't think
> denormalised makes sense in this context. While the OP's problem is
> certainly not a trivial problem to solve with only a content-centric  
> index
> that is no reason to dismiss the requirement out of hand.

You are right in that I could have said that in a nicer way, but I was  
trying to point out that sorting content by when a owner last logged  
in is unusual.

I think, as someone pointed out, that the real user need he is after  
might be simpler than what he is specifically asking for.

> It is possible to get the last login time for a user in Plone (see for
> example: http://pypi.python.org/pypi/collective.lastlogin) and from  
> that it
> should be possible to query for all content by each user. So long as  
> the
> site is not too large this should offer acceptable performance.

or alternately you can try the way I suggested which would do the  
query in a preferment way regardless of size of the site but trades  
this for large numbers of writes each time a user logs in. ie, your  
suggestion is equivalent to writing your own join in python, my  
suggestion is equivalent to denormalising that join and putting the  
last login time as a value in the 'content table'. It's the same kind  
of choice you'd have to make in a db such as in Appengine.

> Let's keep Plone mailing lists friendly, helpful and constructive,  
> people.

yes my apologies.

> Laurence
> --
> View this message in context: http://plone.293351.n2.nabble.com/How-to-search-and-sort-content-based-on-owner-last-login-time-tp7554312p7555624.html
> Sent from the Product Developers mailing list archive at Nabble.com.
> _______________________________________________
> Product-Developers mailing list
> Product-Developers at lists.plone.org
> https://lists.plone.org/mailman/listinfo/plone-product-developers

More information about the Product-Developers mailing list