typesense / typesense

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences

Home Page:https://typesense.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question around `vector_query` param

lyra-white opened this issue · comments

Not really a bug, but more of a question.

curl 'http://localhost:8108/search' \
  -X POST \
  -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
  -d '{
        "searches": [
          {
            "collection": "docs",
            "q": "white shirt",
            "query_by": "vec, non_embedding_field",
            "vector_query": "vec:([], k: 1000)"
          }
        ]
      }'
  1. What is intended behavior of above query? Does k=1000 mean I am always going to get 1000 results?
  2. How does above query work with built-in embedding models? In the examples, sometimes embeddings are passed in the vector_query like vec:([0.96826, 0.94, 0.39557, 0.306488]. If I use typesense for computing the embeddings, I won't have the vector to pass here. So do i need to perform two queries, first to get embeddings, and second to use these embeddings? Or is typesense going to figure out that this field can be filled internally, and computed query embeddings for white shirt are plugged in runtime?
  3. Are vector_query params documented anywhere else? I saw some threads about tuning alpha, etc. Where is the complete documentation?
  1. Yes k means you are looking for the top K nearest embeddings that match the embedding of the query white shirt.
  2. If you use built-in embedding, you don't have to pass the vector explicitly. You can pass an empty [] vector if you want to control the parameters like k. By default k defaults to value of per_page parameter.
  3. We don't have a single table with the parameters listed. The supported params at the moment are: flat_search_cutoff, distance_threshold, alpha, k, ef. There will be sections with examples of these parameters on this page.