#community-help

Issue with Search Term Results in Typesense

TLDR Dipankar had issues with specific search terms returning unexpected results. Kishore Nallan clarified why this may occur and how to fine-tune the behavior using the 'drop_tokens_threshold' parameter in Typesense.

Powered by Struct AI

1

Aug 25, 2022 (16 months ago)
Dipankar
Photo of md5-5b972823ad64a4cfe9700cd5729e8061
Dipankar
12:50 PM
I have few document their title is like this
30 best safari camps and lodges for unforgettable safaris
Night Safari
Tiger safari in Ranthambore National Park
Maharajas Express

If I search for Safari all these appears but if I search safari holiday only the last one appears "Maharajas Express" Why is this happening?

here is my search Client setting
  additionalSearchParameters: {
    query_by: "title,standfirst,catTags",
  }
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
01:17 PM
👋 Can you post the other fields of the Maharajas Express document?
Dipankar
Photo of md5-5b972823ad64a4cfe9700cd5729e8061
Dipankar
04:29 PM
title: "Maharajas Express"

standfirst:"<p>Relive the era of the British Raj on this fabulously luxurious train – and discover the highlights of Rajasthan, from the Taj Mahal and the magnificent royal palaces, to tiger safaris at Ranthambore.</p>"

catTags:"Agra,Asia,Delhi,Golden Triangle,India,Jaipur,Rajasthan,Uttar Pradesh,Best things to do in Agra,Best things to do in Delhi,Best things to do in India,Best things to do in Jaipur,Bucket list experiences in India,Bucket list ideas,Great luxury train journeys,Travel bucket list,Unforgettable luxury train holidays"
Aug 27, 2022 (16 months ago)
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
12:19 AM
By default Typesense returns document's that contains all tokens in the query. In this case his record has both tokens and so return that and stop there. If you want all tokens to be processed, take a look at the drop_tokens_threshold search parameter. It will allow you to fine tune this behavior.
Dipankar
Photo of md5-5b972823ad64a4cfe9700cd5729e8061
Dipankar
06:39 AM
  additionalSearchParameters: {
    query_by: "title,standfirst,catTags",
    drop_tokens_threshold: 0,
  }
06:40
Dipankar
06:40 AM
I added drop_tokens_threshold to 0 but its doing nothing as far i can tell
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
06:41 AM
Must be greater than 1. By setting it to zero you are effectively disabling it.
06:41
Kishore Nallan
06:41 AM
From the docs:

&gt; If at least drop_tokens_threshold number of results are not found for a specific query, Typesense will attempt to drop tokens (words) in the query until enough results are found. Tokens that have the least individual hits are dropped first. Set drop_tokens_threshold to 0 to disable dropping of tokens.
Dipankar
Photo of md5-5b972823ad64a4cfe9700cd5729e8061
Dipankar
06:43 AM
thank you.

1

Typesense

Lightning-fast, open source search engine for everyone | Knowledge Base powered by Struct.AI

Indexed 3015 threads (79% resolved)

Join Our Community

Similar Threads

Understanding Typesense Query Fuzziness and Thresholds

Ashraful was confused about different query results when applying filters in Typesense. Jason clarified the function of `drop_tokens_threshold` and `typo_tokens_threshold` options, explaining their effect on search results and their precedence.

9
3mo

Issue with Query Expectations on Typesense Search

Sean was having an issue with their search query on Typesense. Kishore Nallan suggested adjusting the 'drop_tokens_threshold' parameter. After making the adjustment, Sean found an issue with the order of the results, which was resolved by updating Typesense version.

2

22
2mo

Resolving Typesense Result Issue in Document Collection Queries

Mike was encountering errors when searching for specific query in their Typesense document collection. Jason suggested it may be due to the `drop_tokens_threshold` setting. There was a misunderstanding but after further explanation from Jason, Mike understood and decided to continue the conversation via email.

1

19
22mo

Issue with Typo Correction/Prefix Search and the Role of max_candidates

John noticed inconsistent search results based on max_candidates settings, and Kishore Nallan clarified its role for multi-word queries. They resolved that increasing max_candidates ensures the query isn't prematurely limited.

2

10
18mo

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.

1

14
21mo