(שימוש לרעה ב-bumped_at להשגת מיון דמוי Reddit

סיכום מבוסס בינה מלאכותית

In a discussion titled “(Ab)using bumped_at to achieve Reddit like sorting” in the Dev category, hyd504 seeks to implement Reddit-style topic sorting on their Discourse-based news/political forum, as the default chronological sorting doesn’t suit their use case. They propose manipulating the bumped_at field using a mathematical formula based on topic age and like count, similar to Reddit’s hotness algorithm. They acknowledge potential issues, such as bumped_at being set to future dates, which may trigger exceptions in Discourse’s code. codinghorror initially dismisses the idea, suggesting using Reddit clones instead, but hyd504 insists Discourse is unmatched in quality and only lacks this one feature. codinghorror reiterates Discourse’s commitment to chronological sorting and suggests the Solved plugin — though hyd504 doesn’t see its relevance. riking proposes using /top or /top/daily as the homepage, but hyd504 notes this breaks infinite scroll and user engagement. They plan to experiment in a dev environment, anticipating issues like broken last-visit markers and “new or updated topics” lists, and promise to share findings. They invite others to flag potential side effects they may have missed.

I am running a news/political discussion forum on discourse. The issue I am seeing is that the default sorting that discourse comes with results in complete chaos for my use case since the age of topic matters a lot. For a forum such as mine, Reddit style sorting makes the most sense however my understanding is that there is no straightforward way of achieving it.

I am wondering if it is possible to (ab)use bumped_at to achieve Reddit sorting by doing something like:

def topic_hotness(created_at, like_count)
   /**
      This function translates created_at and like_count
      into bumped_at date using a mathematical formula
      similar to the one used by Reddit. Consider bumped_at
      as a date until which we need the topic to be in the top 10
      given its creation date and number of likes.
   */
end

add_model_callback(Topic, :before_save) do
   self.bumped_at = topic_hotness(self.created_at, self.like_count)
end

Is this going to work? And what features might it break which would need to be addressed. I saw somewhere in the discourse code base where an exception is thrown if bumped_at is in the future. Depending on the formula, using this scheme can result in bumped_at dates in the future. Any thoughts?

Anyone?

Sorry about the bump.

No. Use one of the many Reddit clones out there if you want Reddit.

Unfortunately there is NOTHING comparable to discourse’s quality out there so discourse is my only option. In fact, discourse does almost everything needed for that use case, it is just the homepage sorting that is the missing piece. I have seen in past similar asks (though only a few), so maybe this will help more people in the future.

Well, that is awfully kind of you to say :wink:

But we are strictly commited to chronological sorting in conversations, and only a thin veneer of threading. You may look at the Solved plugin, perhaps?

One alternative is to set your site’s homepage to /top or /top/daily.

Haha. I can say that because I am getting a very good response from my community. The reddit clones out there are not even worth trying.

I am not sure if I understand how the Solved plugin is related to this problem. Does it temper with bump date?

This has its own issues, the timeline has to be infinite scroll to keep the user engaged. Most of my users will bounce off rather than navigating into the categories.

I think what I will do next is to experiment in devo to see what issues I will experience if I override bumped_at and see if I can accept them as tradeoffs. I haven’t looked into the code yet but it seems like the last visit marker will go crazy so I will have to suppress it. Also, I think the “new or updated topics” will be ruined so that might also need some overrides or suppression.

I will share my experience on this thread in case someone else is interested too. Let me know if you guys can think of off the top of your head any other issues it will cause.