On 2012-05-13 03:08, zjs2k wrote:
I would like to hear any suggestion and comment on how to do this. First, I
will create a property/field somewhere to update the user login time
(probably a property on user metadata). They I want to present contents
sorted on user's last login time. So the contents made by the most recently
login user will be listed first. (then, I would sort contents from the same
user by modification date. I think AdvancedQuery can do multiple index
sort.)

Is this possible with zcatalog? Or do I have to go with relational database?
For mysql, I can see "join" table search working for this purpose. But how
do I do it with Plone/zodb? I don't want to update all contents by a user
every time he logs in. It could mean updating thousands of objects for just
one user, who could login multiple times a day. Any thoughts?

I'd do it this way:

a) add a subscriber and let it write login time to some IOBTree (annotate it to the portal) with key Integer-Value from Creator Index and value the login time (maybe using a timestamp similar the one from dateindex can reduce this to use the faster IIBTree).
maybe collective.lastlogin does so or similar, i never used it.

b) write an catalog index 'userslastlogin' which does not store anything, but maps on low-level (IITreeSet) Creator index to login timestamp from your IIBTree and return it sorted. an example how such an index may look is DateRangeInRangeIndex.

So you can - with a good performance - simply ask the catalog to sort_on your new index.

After that youre familar with how to write catalog indexes. It isnt that hard but theres nowhere good documentation about it (except the code itself).

hth Jens
--
Klein & Partner KG, member of BlueDynamics Alliance

_______________________________________________
Product-Developers mailing list
[email protected]
https://lists.plone.org/mailman/listinfo/plone-product-developers

Reply via email to