#community-help

Weighting search parameters: `store_name` vs `tags`

TLDR Shadab needed help with search parameters. Kishore Nallan suggested prioritize_exact_match: false which partially solved the issue. Reading docs helped Shadab find text_match_type: "max_weight", solving the problem.

Powered by Struct AI
Oct 30, 2023 (1 month ago)
Shadab
Photo of md5-41a24213179ff9ed2e32e727399ae6d1
Shadab
07:27 AM
Hi,
I have a query like this
search_parameters = {
    'q': 'work',
    'query_by': 'store_name, tags', //store_name = string "" & tags = String []
    'num_typos': 2,
    'typo_tokens_threshold': 1,
}

Suppose I have fields like this on my doc:-
1. store_name like Work Anniversary, Work Culture.
2. tags on some stores as โ€œworkโ€
I want to show the store_name to take the priority instead of the exact match (tags) in this case.
PS: I have tried query_by_weights but itโ€™s not working how I want
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
08:23 AM
Try setting:

prioritize_exact_match: false
Shadab
Photo of md5-41a24213179ff9ed2e32e727399ae6d1
Shadab
08:30 AM
Yes, partially working now!
But another case ๐Ÿ˜ฌ
1. If I have another Store named as WorkShop then for this case still tags exact match is taking priority.
Is there anyway I can directly add that only when all store_name's are done (whether Work or WorkShop) then process for the tags ?
08:46
Shadab
08:46 AM
Went through the docs Kishore Nallan,
text_match_type: "max_weight"
What I needed is achieved now, thanks.
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
09:02 AM
Glad to hear!