Closed tkimnguyen closed 6 years ago
I would look at the fake getObjPositionInParent index for a model of how to implement this. It's an index object in the catalog, but it doesn't actually store anything. When you sort by it it goes and finds the original folder and returns results in the order from that folder. A "random" sort index could similarly just return a random sort value for each result.
Keep in mind this kind of thing tends to run afoul of cacheability though.
+1 for this feature. For a news site this is very important. Being able to have a collection displaying news items in a random way.
I don't think a lot of people will want this, so this sounds more like an add-on, for example with a behavior or a portlet.
I knew I created something with random content. Okay, I found it. Haven't touched it in five years. It's not quite the same as you want, but maybe collective.randomcontent may serve as inspiration.
I can think of several use cases for this:
I have a folder full of products or banners (propaganda) and want to show a different one each time someone visits the site.
I have a magazine and want to show a more in this issue portlet/collection, but I want a random news item returned, so the site is not frozen between issue numbers
I have a folder full of quotes and want to display a random quote
2017-06-09 13:55 GMT-03:00 Maurits van Rees notifications@github.com:
I don't think a lot of people will want this, so this sounds more like an add-on, for example with a behavior or a portlet.
I knew I created something with random content. Okay, I found it. Haven't touched it in five years. It's not quite the same as you want, but maybe collective.randomcontent https://github.com/collective/collective.randomcontent may serve as inspiration.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/plone/Products.CMFPlone/issues/2056#issuecomment-307442643, or mute the thread https://github.com/notifications/unsubscribe-auth/ADyyM63KEF6D8IjrsSp1hvAEBArjDztTks5sCXj_gaJpZM4NhVWx .
IMO this should be an addon. It is quite simple: provide a (fake) index returning all ids in random order. thats all.
FYI: I closed this, because it's formal not a plip, just a rough idea.
It would be nice ™ to be able to have a collection return results in random order.
as per discussion in https://community.plone.org/t/ideas-for-showing-collection-items-in-random-order/579