#community-help

Implementing OR Query in Typesense for Multiple-Word Search

TLDR Md.Riad was seeking assistance on implementing an OR query in Typesense for multiple word search. Jason clarified that Typesense already provides this feature by default and suggested to adjust the drop_tokens_threshold to obtain more varied results.

Powered by Struct AI

1

1

Sep 03, 2023 (3 months ago)
Md.Riad
Photo of md5-124e496f2dd1dd336c154a3bd23d9ddd
Md.Riad
08:16 AM
Hello,
I want to search by multiple word or words. Means I want OR query by a single search of a collection (where operation like feildName ="value" or feildName = "value2")
For example,
my search keyword is ''plastic bottle"
q :- documentFeild = "plastic" or documentFeild = "bottle"
query_by :- documentFeild

Expected result (documents) :-
1.plastic bottle
2.plastic bag
3.water bottle

1

Md.
Photo of md5-1935057335c7aca5ea2ff057045dc829
Md.
10:07 AM
Jason can you help or any guideline.
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
03:43 PM
This is how Typesense works by default. If all keywords are found in the same document, then Typesense will drop keywords left to right and then right to left, until enough results are found.

Where enough is controlled by the value of drop_tokens_threshold.

So if you increase drop_tokens_threshold: 10000 then you should see more results with different keywords dropped.
Sep 04, 2023 (3 months ago)
Md.Riad
Photo of md5-124e496f2dd1dd336c154a3bd23d9ddd
Md.Riad
04:48 AM
Thanks Jason

1