Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return 'random' results from a collection #2056

Closed
tkimnguyen opened this issue May 20, 2017 · 6 comments
Closed

return 'random' results from a collection #2056

tkimnguyen opened this issue May 20, 2017 · 6 comments

Comments

@tkimnguyen
Copy link
Sponsor Member

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

@davisagli
Copy link
Sponsor Member

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.

@rafaeltcc
Copy link

+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.

@mauritsvanrees
Copy link
Sponsor Member

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.

@rafaeltcc
Copy link

rafaeltcc commented Jun 9, 2017 via email

@jensens
Copy link
Sponsor Member

jensens commented Oct 18, 2017

IMO this should be an addon. It is quite simple: provide a (fake) index returning all ids in random order. thats all.

@jensens jensens closed this as completed Oct 18, 2017
@jensens
Copy link
Sponsor Member

jensens commented Oct 18, 2017

FYI: I closed this, because it's formal not a plip, just a rough idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants