milvus-io / pymilvus

Python SDK for Milvus.
Apache License 2.0
981 stars 312 forks source link

[QUESTION]: 请问hybrid_search中如果有sparse vector的检索,支持partition key吗 #2184

Open lvjg opened 1 month ago

lvjg commented 1 month ago

Is there an existing issue for this?

What is your question?

请求异常,返回内容如下: pymilvus.exceptions.MilvusException: <MilvusException: (code=1100, message=Invalid expr: id in ['2e65e219-48d8-44b2-8c8b-a528076b5c54', ...]: invalid parameter)>

Anything else?

No response

lvjg commented 1 month ago

res = self._collection.hybrid_search( [dense_req, sparse_req], rerank=ranker, limit=query.hybrid_top_k, output_fields=output_fields, group_by_field=group_by_field )

lvjg commented 1 month ago

在hybrid_search中也没有使用expr这个参数

XuanYang-cn commented 1 month ago

https://milvus.io/docs/multi-vector-search.md @lvjg Please refer to this doc. The params of your hybrid_search AIP seems wrong, we need a list of AnnSearchRequest

XuanYang-cn commented 1 month ago

/assign @lvjg

lvjg commented 1 month ago

https://milvus.io/docs/multi-vector-search.md @lvjg Please refer to this doc. The params of your hybrid_search AIP seems wrong, we need a list of AnnSearchRequest

        sparse_emb = self.sparse_embedding_function.encode_queries(
            [query.query_str]
        )[0]
        sparse_search_params = {
            "metric_type": "IP",     
            "params": {
                "radius": 0.1,
                "range_filter": 1.0
            }
        }
        sparse_top_k = query.sparse_top_k or 20
        sparse_req = AnnSearchRequest(
            [sparse_emb],
            self.sparse_embedding_field,
            sparse_search_params,
            limit=sparse_top_k,
        )            

        dense_emb = query.query_embedding
        dense_req = AnnSearchRequest(
            [dense_emb],
            self.embedding_field,
            dense_search_params,
            limit=similarity_top_k,
        )
lvjg commented 1 month ago

使用的是一组AnnSearchRequest