Skip to content

Commit

Permalink
support search group-by(#1809) (#1810)
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 7, 2023
1 parent 161210f commit f12777b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions pymilvus/client/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
DEFAULT_CONSISTENCY_LEVEL = ConsistencyLevel.Bounded
DEFAULT_RESOURCE_GROUP = "__default_resource_group"
REDUCE_STOP_FOR_BEST = "reduce_stop_for_best"
GROUP_BY_FIELD = "group_by_field"
5 changes: 4 additions & 1 deletion pymilvus/client/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from . import blob, entity_helper, ts_utils
from .check import check_pass_param, is_legal_collection_properties
from .constants import DEFAULT_CONSISTENCY_LEVEL, REDUCE_STOP_FOR_BEST
from .constants import DEFAULT_CONSISTENCY_LEVEL, GROUP_BY_FIELD, REDUCE_STOP_FOR_BEST
from .types import DataType, PlaceholderType, get_consistency_level
from .utils import traverse_info, traverse_rows_info

Expand Down Expand Up @@ -612,6 +612,9 @@ def search_requests_with_expr(
if param.get("metric_type", None) is not None:
search_params["metric_type"] = param["metric_type"]

if param.get(GROUP_BY_FIELD, None) is not None:
search_params[GROUP_BY_FIELD] = param[GROUP_BY_FIELD]

if anns_field:
search_params["anns_field"] = anns_field

Expand Down
2 changes: 1 addition & 1 deletion pymilvus/orm/iterator.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def __check_reached_limit(self, ret: List):
def __setup__pk_prop(self):
fields = self._schema[FIELDS]
for field in fields:
if field[IS_PRIMARY]:
if IS_PRIMARY in field and field[IS_PRIMARY]:
if field["type"] == DataType.VARCHAR:
self._pk_str = True
else:
Expand Down

0 comments on commit f12777b

Please sign in to comment.