educative.io

Ranking tweets by popularity

Let’s assume we want to rank tweets by popularity, like how many likes or comments a tweet is getting, etc. In such a case, our ranking algorithm can calculate a ‘popularity number’ (based on the number of likes, etc.) and store it with the index. Each partition can sort the results based on this popularity number before returning results to the aggregator server. The aggregator server combines all these results, sorts them based on the popularity number, and sends the top results to the user.

isn’t the ranking going to get huge lists of tweet ids from each index server? how will it efficiently sort the lists and combine the results to return the top tweets to the user?