diff --git a/pymilvus/client/prepare.py b/pymilvus/client/prepare.py index 9f84247e3..a02023353 100644 --- a/pymilvus/client/prepare.py +++ b/pymilvus/client/prepare.py @@ -596,14 +596,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 4dc0d8d31..b63a409e5 100644 --- a/pymilvus/orm/collection.py +++ b/pymilvus/orm/collection.py @@ -589,8 +589,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:: @@ -602,7 +600,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:: @@ -627,6 +625,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.