I have a question about sorting in Typesense, I ho...
# community-help
l
I have a question about sorting in Typesense, I hope someone can help me with this. I'll give an example of a shop that sells clothes to illustrate the problem, there are 5 categories of mens clothes: a) t-shirts b)shirts c)trousers d)shoes e)coats . Each clothing item receive a numeric "promotion_rank" (1-99) that is used for sorting the results. When a user visits the search and has not chosen a clothing category , we want to predictably show an even number of items of each type sorted by a numeric "promotion_rank". Ideally the results would predictably show an item of each type in a "round-robin" fashion as the results are displayed . Ideally we would show the search results in the following order . 2 t-shirts, 1 shirt, 1trousers, 1shoes, 1coats.....and so on repeating the order as the results descend by the "promotion_rank". Is it possible to order results in this controlled way in typesense?
j
This is not possible to do out of the box. But you can use some business logic that controls the
pinned_hits
search parameter in Typesense and/or the overrides API to achieve this