Hi! I have a question about weighing. Or more I ne...
# community-help
d
Hi! I have a question about weighing. Or more I need an explanation 🙂 I have these two documents
Copy code
{
  id: 1
  productName: "Stripe",
  variantName: "Throw, Black / White"
},
{
  id: 2
  productName: "Monster",
  variantName: "Throw, Ochre / Off-white Stripe"
}
I've set my params to prioritise
productName
over
variantName
, like this
query_by: 'sku,productName,variantName,designer,tags', query_by_weights: '5,4,3,1,2'
. When I search
stripe throw
, id 2 comes before id 1, even through id 1 is an exact hit of the more prioritised field. Why? id 2 has two exact matches in its
variantName
, but I still don't want that to "win" as the
productName
match is more important for me. Images in đź§µ
message has been deleted
j
By default, Typesense considers a field that matches all search terms exactly, to be the most relevant. You can disable this behavior by setting prioritize_exact_matches: false
d
But this matches ”stripe throw” exactly, on both of them, right? Just that on one document it matches on two separate fields
j
We should probably improve the name of that parameter, it should really be “prioritize_exact_match when all matches appear in the same field”. It essentially overrides weights when all keywords exist in the same field
d
Got it. Thanks for explaining!
👍 1