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.
1
1
Sep 03, 2023 (3 months ago)
Md.Riad
08:16 AMI 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.
10:07 AMJason
03:43 PMWhere 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
04:48 AM1
Typesense
Indexed 3015 threads (79% resolved)
Similar Threads
Resolving Typesense Search Issues
Conversation started by Maximilian about Typesense search behavior led to Users Kishore Nallan and Mike discussing and suggesting workaround, with Kishore Nallan promising an official solution soon. No final confirmation of resolution provided.
Using Typesense to Retrieve Multiple Keyword Matches
Ravi expressed confusion over Typesense not returning all results for multi-keyword queries. Kishore Nallan explained that Typesense does `AND` of all keywords and drops tokens from right to left until records are found if no exact match exists. Kishore Nallan clarified that disabling the drop_tokens_threshold could alter this behavior.
Achieving Desired Query Results in Typesense
Timothy asked how to include documents containing any query term in Typesense. Jason explained that by adjusting the `drop_tokens_threshold`, this behaviour can be achieved.