Skip to content

Commit

Permalink
set reduce_stop_for_best for iterator by default(#1830) (#1831)
Browse files Browse the repository at this point in the history
Signed-off-by: MrPresent-Han <[email protected]>
  • Loading branch information
MrPresent-Han authored Dec 28, 2023
1 parent 0266fd0 commit 2b5a27d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion pymilvus/client/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,6 @@ def search_requestV2_with_ranker(
round_decimal: int = -1,
**kwargs,
) -> milvus_types.SearchRequestV2:

use_default_consistency = ts_utils.construct_guarantee_ts(collection_name, kwargs)
rerank_param["limit"] = limit
rerank_param["round_decimal"] = round_decimal
Expand Down
2 changes: 1 addition & 1 deletion pymilvus/orm/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
FIELDS = "fields"
EF = "ef"
IS_PRIMARY = "is_primary"
STOP_REDUCE_FOR_BEST = "stop_reduce_for_best"
REDUCE_STOP_FOR_BEST = "reduce_stop_for_best"
DEFAULT_MAX_L2_DISTANCE = 99999999.0
DEFAULT_MIN_IP_DISTANCE = -99999999.0
DEFAULT_MAX_HAMMING_DISTANCE = 99999999.0
Expand Down
5 changes: 5 additions & 0 deletions pymilvus/orm/iterator.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
PARAMS,
RADIUS,
RANGE_FILTER,
REDUCE_STOP_FOR_BEST,
UNLIMITED,
)
from .schema import CollectionSchema
Expand Down Expand Up @@ -77,12 +78,16 @@ def __init__(
self._kwargs = kwargs
self.__check_set_batch_size(batch_size)
self._limit = limit
self.__check_set_reduce_stop_for_best()
self._returned_count = 0
self.__setup__pk_prop()
self.__set_up_expr(expr)
self.__seek()
self._cache_id_in_use = NO_CACHE_ID

def __check_set_reduce_stop_for_best(self):
self._kwargs[REDUCE_STOP_FOR_BEST] = "True"

def __check_set_batch_size(self, batch_size: int):
if batch_size < 0:
raise ParamError(message="batch size cannot be less than zero")
Expand Down

0 comments on commit 2b5a27d

Please sign in to comment.