The built-in Hot sorting algorithm is very simple and might not be suitable for different use cases. From my basic understanding of Discourse codebase, currently there is not user-facing site settings or appropriate plugin injection point for customizing hot sorting algorithm. There is one topic_hot_scores_updated event but it is called after scores are updated, which serves the purpose of notification without the ability to override built-in hot scores. There are two site settings hot_topics_gravity and hot_topics_recent_days but they have hidden: true set and are not visible in admin UI.
We are considering writing a plugin to replace the built-in hot score algorithm. What approach would be better in terms of compatibility and ease of upgrading Discourse in the future? Some of my ideas are listed below:
- Monkey-patch
TopicHotScoreand update db according to our custom algorithm. - Create a separate table to store topic hot scores and run a separate background job to update them. Add another route (instead of /hot) for our custom hot topic listing.
- Or maybe the Discourse codebase can be improved to support such use case?