This message was deleted.
# community-help
s
This message was deleted.
a
Hey @Ted Mader To use counter analytics ranking, you'll first need to add a popularity score to your documents. Once that's in place, you can apply a custom ranking rule based on that field. Docs: https://typesense.org/docs/guide/ranking-and-relevance.html#ranking-based-on-relevance-and-popularity
t
I have a popularity score and a timestamp representing the creation date of the item. Is there a way to mix both?
I wasn't imagining using counter analytics for this but I can give that more thought
I also see a relevance + recency example, but I am interested in popularity + recency, without any text query
f
You can pass up to three different sorting fields on a single search. The order of which will dictate their sort order on the results. Let's say you have a
sort_by: popularity:desc,created_at:desc
. If there are two documents with the same popularity, then we will use the timestamp to find which one to show first. If you want to give them the exact same weight and have another field be the tie-breaker, then you'd need to create a pseudo-field on your side with an algorithm that will generate the same score for either the timestamp, or the popularity field
t
Hmm okay, that's what I was afraid of, lol. I just need to make a job that recalculates these weighted value fields regularly then. Is there a simpler way to test this out, such as calculating the values at query-time?
f
Sadly, no. Typesense doesn't provide the ability for calculating those values at runtime
t
No worries. I'll get to work then. thanks!