Skip to content

[Bug]: [milvus_client_p2] Unexpected error to invalid reqs and ranker for interface hybrid_search #2588

Open
@binbinlv

Description

@binbinlv

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Unexpected error to invalid reqs and ranker for interface hybrid_search

  1. hybrid search with invalid "reqs" , like non-list for "reqs", it reports:
(code=1, message=Unexpected error, message=<'int' object is not iterable>)>
  1. hybrid search with invalid "ranker" parameter, like "1" for "ranker", it reports:
code=1, message=Unexpected error, message=<'int' object has no attribute 'dict'>)

Expected Behavior

Invalid ...

Steps/Code To Reproduce behavior

    @pytest.mark.tags(CaseLabel.L1)
    @pytest.mark.parametrize("reqs", ["12-s", 1])
    def test_milvus_client_hybrid_search_invalid_reqs(self, reqs):
        """
        target: test hybrid search with inconsistent metric type (default is IP) with that of index
        method: create connection, collection, insert and search with not consistent metric type
        expected: Raise exception
        """
        client = self._client()
        collection_name = cf.gen_unique_str(prefix)
        # 1. create collection
        self.create_collection(client, collection_name, default_dim)
        # 2. hybrid search
        ranker = WeightedRanker(0.2, 0.8)
        error = {ct.err_code: 100,
                 ct.err_msg: f"collection not found[database=default][collection=1]"}
        self.hybrid_search(client, collection_name, reqs, ranker, limit=default_limit,
                    check_task=CheckTasks.err_res, check_items=error)
        self.drop_collection(client, collection_name)

    @pytest.mark.tags(CaseLabel.L1)
    @pytest.mark.parametrize("invalid_ranker", [1])
    def test_milvus_client_hybrid_search_invalid_ranker(self, invalid_ranker):
        """
        target: test hybrid search with inconsistent metric type (default is IP) with that of index
        method: create connection, collection, insert and search with not consistent metric type
        expected: Raise exception
        """
        client = self._client()
        collection_name = cf.gen_unique_str(prefix)
        # 1. create collection
        self.create_collection(client, collection_name, default_dim)
        # 2. hybrid search
        rng = np.random.default_rng(seed=19530)
        vectors_to_search = rng.random((1, 8))
        sub_search1 = AnnSearchRequest(vectors_to_search, "embeddings", {"level": 1}, 20, expr="id<100")
        ranker = WeightedRanker(0.2, 0.8)
        error = {ct.err_code: 100,
                 ct.err_msg: f"collection not found[database=default][collection=1]"}
        self.hybrid_search(client, collection_name, [sub_search1], invalid_ranker, limit=default_limit,
                    check_task=CheckTasks.err_res, check_items=error)
        self.drop_collection(client, collection_name)

Environment details

- Hardware/Softward conditions (OS, CPU, GPU, Memory):
- Method of installation (Docker, or from source):
- Milvus version (v0.3.1, or v0.4.0):  all
- Pymilvus version: 2.5.4rc1
- Milvus configuration (Settings you made in `server_config.yaml`):

Anything else?

No response

Metadata

Metadata

Assignees

Labels

kind/bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions