Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance: refine search_group_by_example(#2481) #2485

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)

Loading