Resolving Typesense Query Issues
TLDR Todd had queries regarding Typesense operation. Jason clarified Typesense's default behavior and provided a recommendation to enhance results ranking based on relevance and recency.
1
Oct 10, 2023 (1 month ago)
Todd
09:33 PM• I noticed when we search for two words with a space separated, only the first word is highlighted. Any way to highlight both words?
• Is it possible to wrap both words in a quote or similar to only specify them together?
• Is it possible to weight results higher where the second word also matches?
Thank you as always, and sorry if I’ve asked any of these questions before already! 😬 :facepalm:
Jason
10:12 PMThat doesn't sound like the default settings... For eg, here's one of our demos showing both words highlighted with the default settings. Could you share a curl command with all the query params you're using, minus the API key that shows this issue on your dataset?
Jason
10:12 PMIs it possible to wrap both words in a quote or similar to only specify them together?Yup, this is called phrase search, and is supported in Typesense, when you surround terms with "double quotes"
Jason
10:12 PMthis is the default behavior as well. Could you share a curl command that shows a different behavior?
Todd
10:13 PMJason
10:13 PMTodd
10:14 PM{
filter_by: `...`,
q: 'One two',
query_by: '...',
sort_by: 'timestamp:desc',
per_page: PAGE_SIZE,
page,
}
Todd
10:15 PMJason
10:16 PMsort_by: 'timestamp:desc'
will strictly order the results by timestamp... and could potentially rank results with higher relevancy further down, if they are more recent.I'd recommend changing that to:
sort_by: '_text_match(buckets: 10):desc,timestamp:desc'
to interview relevance with recency
Jason
10:16 PMTodd
10:18 PM1
Typesense
Indexed 3015 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.
Docsearch Scrapper Metadata Configuration and Filter Problem
Marcos faced issues with Docsearch scrapper not adding metadata attributes and filtering out documents without content. Jason helped fix the issue by updating the scraper and providing filtering instructions.
Typesense Performance with Large Datasets & Custom Sort
krok inquires about Typesense's performance on large datasets and custom sorting. Kishore Nallan explains that Typesense is optimized for this scenario using pagination and text relevance.
Understanding and Adjusting Query Parameter Weights
John needed help understanding default weights, manipulating weights, and sorting by weight in query parameters. Jason educated on default weights, sorting mechanism, and also suggested using buckets for sorting based on custom fields.