#random

Semantic Search Weighting in Typesense 0.25

TLDR Gustavo suggested improvements for semantic search in Typesense. Jason confirmed it's under consideration. Gustavo then found the answer in query_by_weights, though it currently doesn't affect the embedding field.

Powered by Struct AI

1

1

5
3mo
Solved
Join the chat
Aug 19, 2023 (3 months ago)
Gustavo
Photo of md5-f930fdb99fd46477205fa1201164ea50
Gustavo
08:47 PM
Now that semantic search is released in 0.25, I'd like to bring this again as a suggestion for improvement in one of the next releases: https://github.com/typesense/typesense/issues/1035. Use case: I want to make a semantic search with user input, but I want to inject some context. If I use q: ${userInput} ${context}`, the result goes too much towards the context and the user input doesn't have enough weight. I need some way to control the exact weight of each term. Perhaps something like vec:([{ q: "${userInput}", weight: 0.7 }, { q: "${context}", weight: 0.3 }])`.
Aug 22, 2023 (3 months ago)
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
03:24 AM
Yup, on our radar to look into in the next few weeks - month

1

Aug 30, 2023 (3 months ago)
Gustavo
Photo of md5-f930fdb99fd46477205fa1201164ea50
Gustavo
09:35 PM
Oh, I'm skimming the docs and just realized there's already a parameter for weighted search (query_by_weights), and that's much simpler than what I suggested. 😅
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
09:58 PM
Although query_by_weights does not affect an embedding field at the moment...
Gustavo
Photo of md5-f930fdb99fd46477205fa1201164ea50
Gustavo
09:59 PM
Yes, I mean, I guess it would be easier to just make it affect rather than create new syntax

1