Obviously just showing characters sorted by creation date on the homepage is not ideal. Ideally we'd have them sorted by popularity and categories, or something of the sorts. Things to think about:
How will search work?
ElasticSearch is the usual go-to, but that's too heavy and bloated for our specific use case.
Consider whether simple PostgreSQL ILIKE queries will be enough, or whether we should look into lean ES alternatives like MeiliSearch, zinc or sonic.
How will popularity work?
"message count within last (X timeframe)" sounds good.
However, considering that the messages table (or whatever else we use to model them) will be the highest traffic table by far, doing a naive COUNT every time we want to build the homepage will likely cause us problems.
Idea: consider having an additional column on the characters table with an estimated interaction counter or something of the sorts, which can be updated via a background cron job that we can schedule depending on DB load. Index on this and use for sorting.
Obviously just showing characters sorted by creation date on the homepage is not ideal. Ideally we'd have them sorted by popularity and categories, or something of the sorts. Things to think about:
ILIKE
queries will be enough, or whether we should look into lean ES alternatives like MeiliSearch, zinc or sonic.COUNT
every time we want to build the homepage will likely cause us problems.characters
table with an estimated interaction counter or something of the sorts, which can be updated via a background cron job that we can schedule depending on DB load. Index on this and use for sorting.