We are working on a query for fetching the feed, that we usually see in a social media app.
The Logic we want to put there is, this would be the order
If the user is in the contact list then his post will be given Priority
if the user is someone you are following then, his post will be given 2nd priority
if the user is in my nearby location then his post will be given 3rd priority.
Also, time is also a critical aspect when calculating the priority,
for example, lets suppose the current time is 4 PM, someone from my contacts posted at 1 PM, lets call it post 1 & there is someone else in the following list who posted at 2 PM lets call it post 2, then we need the follower post to come first in the feed rather than the post 1
But if we are applying sorting based on contacts then it’s returning all the posts for my contacts first irrespective of the time they are posted on.
Is there any approach using which we can sort based on the combination or conditional-based sorting?