FEATURE: improvements to hot algorithm (#25295)

- Decrease gravity, we come in too hot prioritizing too many new topics
- Remove all muted topics / categories and tags from the hot list
- Punish topics with zero likes in algorithm
This commit is contained in:
Sam
2024-01-17 16:12:03 +11:00
committed by GitHub
parent 54e6c1d823
commit df8bb947b2
5 changed files with 49 additions and 16 deletions

View File

@@ -100,11 +100,11 @@ class TopicHotScore < ActiveRecord::Base
# we need an extra index for this
DB.exec(<<~SQL, args)
UPDATE topic_hot_scores ths
SET score = topics.like_count /
SET score = (topics.like_count - 1) /
(EXTRACT(EPOCH FROM (:now - topics.created_at)) / 3600 + 2) ^ :gravity
+
CASE WHEN ths.recent_first_bumped_at IS NULL THEN 0 ELSE
(ths.recent_likes + ths.recent_posters) /
(ths.recent_likes + ths.recent_posters - 1) /
(EXTRACT(EPOCH FROM (:now - recent_first_bumped_at)) / 3600 + 2) ^ :gravity
END
,