Skip to content

Commit

Permalink
enhance: refine search_group_by_example(#2481) (#2485)
Browse files Browse the repository at this point in the history
related: #2481

Signed-off-by: MrPresent-Han <[email protected]>
Co-authored-by: MrPresent-Han <[email protected]>
  • Loading branch information
MrPresent-Han and MrPresent-Han authored Dec 19, 2024
1 parent 08c6d05 commit a4ead48
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions examples/search_group_by.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,8 @@ def print_res(result: List[List[dict]]):


vector_to_search = rng.random((nq, DIM), np.float32)
# just search_group_by, no group_size, only 1 entities per group
# only 1 entity per group of AGE
res = milvus_client.search(collection_name, data=vector_to_search, limit=10, anns_field=PICTURE,
output_fields=[USER_ID, AGE], group_by_field=AGE)
print_res(res)

# search_group_by, with group_size=3, but not strict_group_size, entity number in per group may be 1~3
res = milvus_client.search(collection_name, data=vector_to_search, limit=10, anns_field=PICTURE,
output_fields=[USER_ID, AGE], group_by_field=AGE, group_size=3)
print_res(res)

# search_group_by, with group_size=3, and strict_group_size=true, entity number
# in per group will be exactly 3 if data's sufficient
res = milvus_client.search(collection_name, data=vector_to_search, limit=10, anns_field=PICTURE,
output_fields=[USER_ID, AGE], group_by_field=AGE, group_size=3, strict_group_size=True)
print_res(res)

0 comments on commit a4ead48

Please sign in to comment.