Skip to content

Commit

Permalink
set reduce_stop_for_best for iterator by default(#1830) (#1832)
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 2232c8d commit a38a502
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
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 a38a502

Please sign in to comment.