Monday 23 March 2009 2:58:00 am
Hi all, I can't find a way to fetch the "most related objects" of a given content_class. Basically, my users are invited to create "selections" ("selection" content_class is based on a object_relations attribute) to select the articles they like. To display the 5 most selected articles within a certain period, I found 2 ways which are much beyond my developing skills :
1st way :
- fetch all articles (tree fetch)
- foreach article : fetch with "reverse_related_objects_count"
=> how can I store the count for each article, and then sort articles by count? => how can I restrict to a certain timeframe?
2nd way :
- fetch all selections (tree fetch)
- foreach selection
- check if selection was created within the timeframe
- get related article node_id and append it to an array => how can I sort the node_ids by number of repetitions in this array? Any help would be highly appreciated :-)
Thanks in advance Mikrob
|