diff --git a/pymilvus/client/prepare.py b/pymilvus/client/prepare.py index 8e90c1dbf..f6b4ca22a 100644 --- a/pymilvus/client/prepare.py +++ b/pymilvus/client/prepare.py @@ -585,14 +585,24 @@ def search_requests_with_expr( params = param.get("params", {}) if not isinstance(params, dict): raise ParamError(message=f"Search params must be a dict, got {type(params)}") + search_params = { "topk": limit, "params": params, "round_decimal": round_decimal, - "offset": param.get("offset", 0), "ignore_growing": ignore_growing, } + # parse offset + if "offset" in kwargs and "offset" in param: + raise ParamError(message="Provide offset both in kwargs and param, expect just one") + + offset = kwargs.get("offset") or param.get("offset") + if offset is not None: + if not isinstance(offset, int): + raise ParamError(message=f"wrong type for offset, expect int, got {type(offset)}") + search_params["offset"] = offset + if param.get("metric_type", None) is not None: search_params["metric_type"] = param["metric_type"] diff --git a/pymilvus/orm/collection.py b/pymilvus/orm/collection.py index edc739764..792020868 100644 --- a/pymilvus/orm/collection.py +++ b/pymilvus/orm/collection.py @@ -663,8 +663,6 @@ def search( similar metricy types, the value must be of type str. * *offset* (``int``, optional) offset for pagination. - * *limit* (``int``, optional) - limit for the search results and pagination. * *params of index: *nprobe*, *ef*, *search_k*, etc Corresponding search params for a certain index. example for param:: @@ -676,7 +674,7 @@ def search( } limit (``int``): The max number of returned record, also known as `topk`. - expr (``str``): The boolean expression used to filter attribute. Default to None. + expr (``str``, Optional): The boolean expression used to filter attribute. example for expr:: @@ -701,6 +699,9 @@ def search( The callback function which is invoked after server response successfully. It functions only if _async is set to True. + * *offset* (``int``, optinal) + offset for pagination. + * *consistency_level* (``str/int``, optional) Which consistency level to use when searching in the collection.