how does one utilize `distance_threshold` with the...
# community-help
a
how does one utilize
distance_threshold
with the automatic embeddings in a hybrid search?
f
So if you find that you're getting too many irrelevant results with semantic search, you can use the
distance_threshold
parameter in
vector_query
to pick an appropriate threshold that works for your use case. Some docs
a
thanks but I was asking specifically how to add distance_threshold with the automatic embedding generation
f
The example in the documentation is for the automatic embedding models
a
not sure how we’re getting our wires crossed here - I want to leverage the automatic embedding generation, including the search term. I don’t want to be in the business of sending TS an embedding for the query. the example you linked to requires me to do so
f
Copy code
let search_parameters = {
  'q'                          : 'chair',
  'query_by'                   : 'embedding,product_name',
  'vector_query'               : 'embedding:([], distance_threshold:0.30)'
}

client.collections('products').documents().search(search_parameters)
The example showcased in the docs passes no embeddings to the search query. It also queries by the embedding field, which is only available on automatic embedding generation
a
I see. in this case I think the documentation could be a lot clearer. something along the lines of letting the user know that the empty array is valid and required if one wants to set distance_threshold with automatic embeddings
thanks for the assist
f
There's mention of querying by auto embedded fields: https://typesense.org/docs/29.0/api/vector-search.html#semantic-search But yes, we'll probably add a small section mentioning how to query by an auto embedded field and manually passing in embeddings as well.
a
well this particular use case is changing the distance while not passing embeddings. that deserves distinction imho
👍 1