I'm working on a reddit-like link aggregator site, which has:
- Posts attached to communities
- Posts have vote scores
- A front page of popular posts
The problem is that sometimes the front page will only have posts from very popular communities, and none from unpopular, small communities.
I need a way to limit the number of communities joined per fetch, to something small, so that a front page will have posts from many communities.
For simplicities sake ( disregarding my more complicated post ranking logic ), the SQL is currently:
select * from post p
inner join community c on p.community_id = c.id
order by p.score desc;
Is there any way to limit the number of community results this fetch returns?
Thanks in advance.