Querying TypeSense with Different Search String Orders
TLDR Jesper needed explanation on the difference in TypeSense search results for "X Y" and "Y X". Kishore Nallan clarified that Typesense treats the last word as a prefix query, explaining the discrepancy.
Jul 11, 2023 (5 months ago)
Jesper
11:57 AMWe're currently exploring the usability of TypeSense for several new websites we plan to build in 2024. As part of our testing process, we're experimenting with different aspects of the platform.
During my investigation, I came across a specific issue that I haven't been able to find an answer to in the documentation. It's possible that I'm simply not interpreting the documentation correctly.
The problem we've encountered involves a discrepancy in search results when searching for "X Y" versus searching for "Y X". I'm curious about how TypeSense weighs the input of the search string and would like to know where I can find more information on this topic.
Based on my observations, it seems that when there are multiple words in the search query, the second word might even contribute to a negative score.
I appreciate any assistance or guidance you can provide.
Best regards,
Jesper
Kishore Nallan
12:11 PMX Y
Y is searched as a prefix and in Y X
X is searched as a prefix. This can lead to the results being different. If you don't want this behavior you can set prefix: false
Jesper
12:29 PMTypesense
Indexed 3015 threads (79% resolved)
Similar Threads
Typesense Search Query
Mischa was having issues with a Typesense search query and Jason suggested setting the prefix parameter to false.
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.
Issues with Prefix Search and Sorting Results in Typesense
Pankaj asked about prefix search issues and sorting results in Typesense. Kishore Nallan explained prefix search limitations and suggested using text_match for sorting. Filtering with prefix searching isn't supported.