Increasing Relevance of Search Results in Specific Books
TLDR Dave wanted to prioritize search results from a specific book. Jason suggested using _eval
with sort_by
to achieve the desired outcome.
1
Feb 06, 2023 (8 months ago)
Dave
04:32 PMEach document contains the plaintext content of a paragraph, the code that identifies the book, and other stuff. My hack is to append the current book’s code to the user’s search before submitting it, and to set the
queryBy
to content, code
, which makes the search return relevant content, and prefer results containing the code.However, by appending the code to the user’s query, I effectively disable the prefix search, because their query is never at end of the query string (the code is).
Is there a better way of handling this?
Jason
05:23 PMYou could split this into two searches in a multi_search request.
Search 1: You’d add a filter_by to only search inside the books that the user is reading
Search 2: Add a filter_by to exclude the books that the user is reading
Then show the results from Search 1 first, if it returns hits. Then show results from Search 2
Dave
07:14 PMJason
08:37 PMDave
09:58 PMJason
10:00 PMJason
10:01 PMsort_by: _eval(book_id:<code>)
Dave
10:39 PMDave
10:40 PMsort_by: `_text_match:desc,_eval(code: "${book_code}"):desc`
Dave
10:40 PM1
Dave
10:41 PMJason
10:42 PMTypesense
Indexed 2779 threads (79% resolved)
Similar Threads
Discussing Filter Operators in Typesense
Roshan asked about the functionality of the 'contains' operator in Typesense filters. Kishore Nallan explained how to use the operator and suggested using a curl query for better insight into the issue. However, the thread ends without a resolution.
Faceting and Filtering Issue in Typesense
Hauke faced issues with facets filtering in Typesense. Kishore Nallan recommended using the instantsearch.js JS library or the multi_search endpoint for independent search queries.
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.
Resolve Facets and Sorting Issues with Typesense
Ethan needed assistance with getting all facet values and sorting results by date using Typesense. Jason provided guidance on how to use Typesense properties to accomplish these tasks, and resolved issues related to specific use-cases provided by Ethan and Rushil.
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.