No I dont think “pinned_hits” seems the elegant way, instead we will sort the results on the FE.
Let me try explaining again. Our problem statement is to show customers a list of suppliers in accordance to the availability of Parts he is ordering . Now if customer orders Parts with different quantities, lets say P1 : 10 and P2: 20, we calculate ranks(custom algo) of suppliers in the database in accordance to the required parts and the quantities in the customer order.
It means we calculate ranks using custom Ranking Algo when Order is received and is not pre-calculated . Ranking of Suppliers is dependant on incoming order and its requirements.
Question
How can we inject these scores (from Ranking Algorithm) of Suppliers to the typesense query something of this sort
Hey Typesense , give me list of all Suppliers with you where P1 >=10 and P2>=20 and also sort them using our Algorithm A.
Approach 1 :
One of the possible approaches in our mind is to do the following query
Hey Typesense , give me list of Suppliers with you where P1 >=10 and P2>=20
and then do sorting in accordance to our Rank algorithm on FE.
Approach 2:
Typesense allows us to Provide Algorithm which is executed on Typesense servers to determine the Sort order and return the final results.