#community-help

Adjusting Sensitivity of Search Queries in Typesense

TLDR Sruli asked how to modify Typesense search query parameters. Kishore Nallan clarified and suggested changing the drop_tokens_threshold to 0.

Powered by Struct AI

1

Jan 06, 2023 (11 months ago)
Sruli
Photo of md5-8c57c435e01337c18bf32b8f7749cabf
Sruli
06:46 AM
Hey, right now when I search the query is very loose and will find something as a hit even if just 1 of the words in a sentence are somewhat matching for example

If the I query for “There was a storm last night” and in Typesense the value is “There are many dangers when traveling by boat, such as stormy nights.”

This will return a hit because of storm/stormy being similar, is there a way to adjust what counts as a hit?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
06:47 AM
Typesense first tries to fetch results that contain all results verbatim, and will proceed to relax the query only when such results are not found.
06:49
Kishore Nallan
06:49 AM
It does that by looking at typos of the words and also by dropping tokens from the query. If you don't wish to drop any tokens you can set drop_tokens_threshold to 0
Sruli
Photo of md5-8c57c435e01337c18bf32b8f7749cabf
Sruli
06:49 AM
First off, thanks for your quick and insightful reply!

1

06:49
Sruli
06:49 AM
Can you elaborate on the drop_tokens_threshold part tho?
Sruli
Photo of md5-8c57c435e01337c18bf32b8f7749cabf
Sruli
07:07 AM
Thanks!