Hello everyone!
My app has posts and I would like to use “do a search for” to show the post with the most likes. My “posts” data has “a list of likes”. Any ideas??
Hello everyone!
My app has posts and I would like to use “do a search for” to show the post with the most likes. My “posts” data has “a list of likes”. Any ideas??
Interestingly, if you go from the Posts towards Likes, it is very tricky. You can do this and I am pretty sure, it is terrible in terms of performance.
However, if your Like datatype have a column for the Post it corresponds to, it is easier.
The counting method would work, although if it becomes too search-intense and consumes too much WU, here’s what I’m doing: everytime a post is ‘Liked’ it is creating a new ‘Like’, and adding +1 to the ‘total likes’ field on that thing. Now I have a stable number field to reference, display, sort by, etc. The opposite logic is true as well - when someone who liked something unlikes it, it deducts ‘1’ from that total. Now instead of needing to do a count everytime I need to reference it, I already have the total ready to go in basic number form.
Just a note, this would become very costly workload wise at scale.
I would suggest having a data type on the post called likes which accumulates, then a second type called site stats or something. Then with a backend workflow every hour or so you can do a search for the top posts and save them as a list of top posts in your site stats object, which you use to display this.
I think I’m missing something, somehow I get no results and the backend workflow is not working, and when it works, its updating the info as soon as click “like”:
I’ll send you a dm
Why not share here so others may see the answer?
I was offering to help you via screen share to explain the concepts etc, not sending you a DM with answers
This topic was automatically closed after 70 days. New replies are no longer allowed.