A question on the workings of the weights we set. ...
# community-help
j
A question on the workings of the weights we set. We sometimes experience that when changing the weighting settings (adjusting given weights up or down), some searches go from X results to 0 results. This seems counterintuitive. If a search yields results with some weight settings, it should always return some results with other settings. Only parameters set are the
query_by
,
query_by_weights
and
text_match_type
(
max_weight
). If I change weights from "50,30,10,59,20,30,20,1,60,1,1" to "*60*,30,10,59,20,30,20,1,60,1,1" I go from zero to 127 hits What can cause a given search to yield zero results just by adjusting the weights?
So it looks like it only looks at the field with highest weight
And it is with a synonym. So we have a 1-way synonym, where the query in the above is the root of the synonym
So ultimately, it seems like synonym searches are only using the field with the biggest weight
a
Hey Jesper, This aligns with how Typesense handles searches to improve performance. You can read a bit more here: https://typesense.org/docs/guide/faqs.html#when-i-search-for-a-short-string-i-don-t-get-all-results-how-do-i-address-this Could you try increasing your max_candidates parameter or even try using exhaustive_search?
j
Doesn't make a difference. Just seems like synonyms only match the highest weight property and disregard the rest
a
Is this behaviour only when using synonym?
j
Yes. I get two different results when searching for the "root" and when I search for the synonym
Can you confirm that it is a known issue (or intended behavior?), that synonyms are only expanded on the fields with the highest weight?
a
No, doesn't seem intended. CC: @Kishore Nallan
k
I checked on the logic used. All we do is this: 1. Take the query tokens 2. Try to match it against all the synonym rules for substitution. We try from the largest to smallest substitution possible (i.e. phrases preferred over individual words) 3. Query it Can you please post an exact query where this happens?
j
I have difficulties reproducing in a simple index with few docs and simple data. I can reproduce easily with a simple query in a prod index. I'll send you a PM
👍 1