Skip to content

Commit 7c09c5c

Browse files
MrPresent-HanMrPresent-Han
andauthored
feat: support group_size parameter for search_group_by (#2130)
related: #2129 Signed-off-by: MrPresent-Han <[email protected]> Co-authored-by: MrPresent-Han <[email protected]>
1 parent 08eff03 commit 7c09c5c

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

pymilvus/client/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
DEFAULT_RESOURCE_GROUP = "__default_resource_group"
1111
REDUCE_STOP_FOR_BEST = "reduce_stop_for_best"
1212
GROUP_BY_FIELD = "group_by_field"
13+
GROUP_SIZE = "group_size"
1314
ITERATOR_FIELD = "iterator"
1415

1516
RANKER_TYPE_RRF = "rrf"

pymilvus/client/prepare.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from .constants import (
1616
DEFAULT_CONSISTENCY_LEVEL,
1717
GROUP_BY_FIELD,
18+
GROUP_SIZE,
1819
ITERATOR_FIELD,
1920
REDUCE_STOP_FOR_BEST,
2021
)
@@ -667,6 +668,10 @@ def search_requests_with_expr(
667668
if group_by_field is not None:
668669
search_params[GROUP_BY_FIELD] = group_by_field
669670

671+
group_size = kwargs.get(GROUP_SIZE)
672+
if group_size is not None:
673+
search_params[GROUP_SIZE] = group_size
674+
670675
if param.get("metric_type") is not None:
671676
search_params["metric_type"] = param["metric_type"]
672677

0 commit comments

Comments
 (0)