Query Suggestions and Result Modification in TS
TLDR Ashraful needed advice on refining query suggestions in TS. Jason recommended reducing the result quantity and utilizing snippet fields. When additional issues were raised, Jason proposed adjusting the 'highlight_affix_num_tokens' setting.
Aug 21, 2023 (1 month ago)
Ashraful
10:06 AMI have a question regarding the query suggestion.
Is there any OOTB feature / custom solution in TS, where I can show end users some query suggestion based on what he is typing? it should meet the following criteria:
1. It should be as precise as possible (i.e. q-> auto, results -> automotive, automatic, automation etc, q-> car auto, results -> car automotive, car automatic, car automation etc).
2. Suggestion should result in having one or more actual results.
That means, the above suggestions automotive, automatic, automation should come from my primary index, so that when i search using any of the keyword it is guaranteed to be returned some results.
I know, that TS has a built-in popular queries mechanism, but that is not appropriate in my scenario, as it does not guarantee any actual result in my primary index.
My current implementation is to query the primary index for page title attribute , and return the records. Results are guaranteed, but most the time it has a full sentence / large number of words, which defeats the purpose.
Thanks in advance.
Jason
05:13 PMThis would indeed be the solution.
> Most the time it has a full sentence / large number of words
You can set
per_page
to say 4
to show users only the top 4 results.You can also use the snippet field in the response, to only show the most relevant part of the field to the user
Aug 22, 2023 (1 month ago)
Ashraful
01:17 PM• You can set
per_page
to say 4
to show users only the top 4 results.Yes, but the number of results is not the concern here, but rather the number of words are.
• You can also use the snippet field in the response,
Yes, but in that case, I may see the same snippet word multiple times.
You can take a look at the image.
the snippet wraps around the same word.
is there a way to increase/decrease the amount of letters to be snipetted?
Jason
07:37 PMhighlight_affix_num_tokens
will control the length of the snippet, documented in this table: https://typesense.org/docs/0.25.0/api/search.html#results-parametersTypesense
Indexed 2764 threads (79% resolved)
Similar Threads
Phrase Search Relevancy and Weights Fix
Jan reported an issue with phrase search relevancy using Typesense Instantsearch Adapter. The problem occurred when searching phrases with double quotes. The team identified the issue to be related to weights and implemented a fix, improving the search results.


Adjusting Text Match Score Calculation in TypeSense
Johannes wanted to modify the Text Match Score calculation in TypeSense to improve search results returns. With counsel from Jason and Kishore Nallan, various solutions were proposed, including creating a Github issue, attempting different parameters, and updating Docker to a new version to resolve the matter.

Understanding Indexing and Search-As-You-Type In Typesense
Steven had queries about indexing and search-as-you-type in Typesense. Jason clarified that bulk updates are faster and search-as-you-type is resource intensive but worth it. The discussion also included querying benchmarks and Typesense's drop_tokens_threshold parameter, with participation from bnfd.
