I am trying to use the embedding distance threshol...
# community-help
w
I am trying to use the embedding distance threshold. I am getting the following error, but only when the query uses a star (any). here is the search query with parameters and here is the error:
Copy code
When a vector query value is empty, an `id` parameter must be present.
Am I doing something wrong? It seems to work when q is anything other than *
k
To sort the records on the distance between records in the hits and a query vector, some reference query vector should be passed in. Otherwise, how would the distance be calculated?
w
I hear what you're saying. I just assumed it would be like the keyword search where * just returns everything. because we are using instantsearch to query typesense, I don't think we can dynamically alter that vector_query parameter and have to add it to the typesense adapter.
k
Got it. We will handle this quirk. Maybe just make vector_query ignored when its empty and
q=*
1
w
yea that would make sense.
j
On a side note, while we implement this, here's how to dynamically set typesense-instantsearch-adapter parameters based on the query: https://github.com/typesense/showcase-hn-comments-semantic-search/blob/8a33006cae58b425c53f56a64e1273e808cd9375/src/js/index.js#L105-L131
w
ah, that's actually super helpful. Thanks guys. We also had this problem with grouped queries, so this solves both.
🙌 1
j
Oh actually, I just realized that each parameter that needs "runtime" change support, needs to be explicitly added to the adapter library... So for group by, we need to handle that separately.
But may be for group_by you could reinstantiate the adapter with a different additionalSearchParameters setting
w
it's all good. tbh we are trying to remove instantsearch from our app and just building a small wrapper around the typesense api. Instantsearch has a bunch of limitations and things that don't work super well out of the box for complex queries.
if you have suggestions for other wrappers then I'm all ears.
j
A user built this: https://github.com/jquery/typesense-minibar But it only has a search bar.
Oh just noticed that that project is inside the jquery GitHub org!