Rethinking the Logic of Topic Popularity Ranking
-
@baris said in Rethinking the Logic of Topic Popularity Ranking:
Similarly, for "monthly popular topics," the calculation should focus on the number of posts contributed to a topic within the last 30 days, disregarding its creation date. As long as a topic remains actively discussed by members, it should maintain its position on the popularity list.
I've made a change to implement this, going to test it a bit and see how it behaves. It is live on this forum https://community.nodebb.org/popular?term=monthly.
Thanks
-
It is based on how many posts are made in the last 30 days. Not sure what's going on with the fediverse topic, then again that topic shows 28 total posts but the db says 26
https://community.nodebb.org/popular?term=daily might be a better example.
Targeted Multi-User tagging
topic was started in 2023 but had posts today so it shows up inpopular?term=daily
-
@dave1904 said in Rethinking the Logic of Topic Popularity Ranking:
@baris Cool! How do you calculate it? It doesn't seem to be based on most posts at the moment?
edit: I was just confused, of course the number of posts isn't recalculated for a topic if you filter monthly.
yeah, it should be the most posts at the selected time frame...
I believe this is the relevant commit:
testing popular sorting ยท NodeBB/NodeBB@038f726
Node.js based forum software built for the modern web - testing popular sorting ยท NodeBB/NodeBB@038f726
GitHub (github.com)
-
@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.