qdrant / qdrant-haystack

An integration of Qdrant ANN vector database backend with Haystack
Apache License 2.0
42 stars 11 forks source link

Add SearchParams to query_by_embedding #35

Open pandasar13 opened 10 months ago

pandasar13 commented 10 months ago

In qdrant you can pass hnsw_ef to the SearchParams to indicate the ef_search value. However,this feature is not present in qdrant-haystack.

My idea would be to add a parameter to the init in which you could optionally specify the ef_search , and if not specified then it simply uses the same value given to ef_construction.

It could be added to qdrant-haystack in the query_by_embedding function.

points = self.client.search(
            collection_name=index,
            query_vector=cast(list, query_emb.tolist()),
            query_filter=qdrant_filters,
            limit=top_k,
            with_vectors=return_embedding or True,

          #parameter to add
           search_params=rest.SearchParams(hnsw_ef=128, exact=False)
        )

Thehnsw_efand exact could be passed to the init as a dictionary. If not given they would default to the qdrant default.