Hey guys, I have a collection called `agents`, eac...
# community-help
s
Hey guys, I have a collection called
agents
, each agent in that index can have
primary_market
. Example, for an agent called Jack
primary_market: [Sydney-NSW-2000-Australia, Pots-Point-NSW-Australia]
, For an agent called Bill
primary_market: [Pots-Point-NSW-Australia, Sydney-NSW-2000-Australia]
When i filter for agents using the slug
Sydney-NSW-2000-Australia
i want to have Jack on top of the results based on the position of the slug inside the
primary_market
and Bill to be at the bottom of the results. Basically i want to sort the results based on the position of the slug i am filtering by inside the
primary_market
array. Likewise if i filter for agents using the slug
Pots-Point-NSW-Australia
i want Bill to be at the top of the results and jack to be at the bottom. Is that even possible? or even an alternative way where i can achieve the same outcome? Any help would be awesome.
k
👋 It's not possible to sort results that way. I can't think of a way to achieve this on the server side. But on client side, since you already know the filter condition you can probably sort the results this way.