FEATURE: experiment with hot sort order (#25274)

This introduces a new experimental hot sort ordering. 

It attempts to float top conversations by first prioritizing a  topics with lots of recent activity (likes and users responding) 

The schedule that updates hot topics is disabled unless the hidden site setting: `experimental_hot_topics` is enabled. 

You can control "decay" with `hot_topic_gravity` and `recency` with `hot_topics_recent_days` 

Data is stored in the new `topic_hot_scores` table and you can check it out on the `/hot` route once 
enabled. 
---------

Co-authored-by: Penar Musaraj <pmusaraj@gmail.com>
This commit is contained in:
Sam
2024-01-17 13:01:04 +11:00
committed by GitHub
parent 1a752148a9
commit ebd3971533
10 changed files with 259 additions and 2 deletions

View File

@@ -338,6 +338,14 @@ class TopicQuery
create_list(:bookmarks) { |l| l.where("tu.bookmarked") }
end
def list_hot
create_list(:hot, unordered: true) do |topics|
topics.joins("JOIN topic_hot_scores on topics.id = topic_hot_scores.topic_id").order(
"topic_hot_scores.score DESC",
)
end
end
def list_top_for(period)
score_column = TopTopic.score_column_for_period(period)
create_list(:top, unordered: true) do |topics|