Rethinking the Logic of Topic Popularity Ranking
-
@baris what about "year"? I think there should be a step between 30 days and eternity
-
The problem with that is performance, the way we calculate this right now is to load all post ids made in the past 30 days and then find their topic ids and sort by the number of posts. If we allow a year then it will load all posts made in the past year to get the post counts for sorting.
-
@baris said in Rethinking the Logic of Topic Popularity Ranking:
The problem with that is performance, the way we calculate this right now is to load all post ids made in the past 30 days and then find their topic ids and sort by the number of posts. If we allow a year then it will load all posts made in the past year to get the post counts for sorting.
I see... how is "all time" calculated? maybe there is a shortcut from that calculation, rather than calculating from scratch ?
-
@crazycells All-time is easy because we don't do any calculations there.
Whenever a new post is made to a topic we increment a value for that topic in a sorted set called
topics:posts
.You can see topic id 180 has the most posts with 625.
When displaying all time we just load that sorted set from highest score to lowest. Since there is no time range it is a single db call.
-
@baris I see, of course you have a better understanding, but could you get the all-time popular topic list, and determine the first post id that was created after the one-year mark for each topic? Then, subtract that number from the total post count of the topic... and re-sort the list based on calculated value? It might not be perfect, but probably it will give something very similar to the real list?
Or, maybe this is a worse performance killer?
-
@crazycells yup not possible at the moment without loading everything.
-
@baris said in Rethinking the Logic of Topic Popularity Ranking:
@crazycells yup not possible at the moment without loading everything.
lol no problem at all.. please ignore me then... NodeBB is very fast right now and I like it this way , if this addition will cause any performance issues, it is better not to add it...
Thanks again for the new popularity rankings, I think it makes more sense this way...
-
hi @julian , right now, "uncategorized" fediverse posts are dominating the
/popular
page... is this intended? -
@crazycells ah, not at all.. but...
Man, that's cool. I think there's definitely a lot of utility in seeing popular uncategorized posts.
I'll take a closer look.
Edit: This is resolved now. Uncategorized topics should no longer appear in
/popular
unless that category is explicitly selected.