Does anybody know how to proritize the result from...
# community-help
s
Does anybody know how to proritize the result from the first word than the second word in Autocomplete search?
k
👋 can you give an example so I can understand better?
s
For example: we have results like 1. Adele 2. Bring Me the horizon When I search "adele someone like me", it shows "Bring Me the Horizon". I want "Adele" to be shown.
k
Is there is a record with title "someone like me" in the dataset?
d
Hi Kishore this is with a multi search use case There are two collections Artists and Songs the Artist is : Adele and the Song is Adele - Woman like me When we type Adele Woman Like Me The result for Adele does not show up / returned for Artist Adele Rather we’re getting a different result - it almost seems like the last word is prioritized over the first.
k
Just to confirm, you are querying two different collections or two different fields in the same collection? In any case when Typesense does not find all tokens in the query, it tries to drop tokens from right to left and then left to right until results are found. This behavior might be resulting in the ordering you notice.
d
we’re querying two different collections artists and songs
we really need to prioritize left to right cause artists name is presumed to be the first
or most priority
k
In latest 0.23 RC you can use dynamic filtering feature in which you can define a rule for queries that begin with artist name where it will get converted into a filter clause directly. However, even then if other tokens don't match no results are going to be found. We might have to parameterise this behavior but what if people put the artist last?
d
you’re right - i need to think of this more too no problems with single collection but for multi search it’s something to think about