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

[Bug]: Searching without specifying metric type results in negated IP #25504

Closed
filip-halt opened this issue Jul 11, 2023 · 12 comments
Closed

[Bug]: Searching without specifying metric type results in negated IP #25504

filip-halt opened this issue Jul 11, 2023 · 12 comments
Assignees
Labels
kind/bug Issues or changes related a bug stale indicates no udpates for 30 days triage/accepted Indicates an issue or PR is ready to be actively worked on.
Milestone

Comments

@filip-halt
Copy link
Contributor

filip-halt commented Jul 11, 2023

col = Collection("test_collection")
res = col.search(data=[[.5,.5]],
                 anns_field="embedding",
                 param={"metric_type": "IP"},
                 limit = 2,
)
print(res)
# ["['id: test_id2, distance: 0.5, entity: {}', 'id: test_id1, distance: 0.5, entity: {}']"] <-- CORRECT

client = MilvusClient(uri, token=token)
res = client.search("test_collection", 
                    [[.5,.5]], 
                    limit=2, 
                    search_params={"metric_type": "IP"},
)
print(res)
# [[{'id': 'test_id2', 'distance': 0.5, 'entity': {}}, {'id': 'test_id1', 'distance': 0.5, 'entity': {}}]] <-- CORRECT

col = Collection("test_collection")
res = col.search(data=[[.5,.5]],
                 anns_field="embedding",
                 limit = 2,
                 param={}
)
print(res)
# ["['id: test_id2, distance: -0.5, entity: {}', 'id: test_id1, distance: -0.5, entity: {}']"] <-- INCORRECT

client = MilvusClient(uri, token=token)
res = client.search("test_collection", 
                    [[.5,.5]], 
                    limit=2, 
)
print(res)
# [[{'id': 'test_id2', 'distance': -0.5, 'entity': {}}, {'id': 'test_id1', 'distance': -0.5, 'entity': {}}]]
@filip-halt filip-halt added kind/bug Issues or changes related a bug needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jul 11, 2023
@yanliang567
Copy link
Contributor

/assign @czs007
/unassign

@sre-ci-robot sre-ci-robot assigned czs007 and unassigned yanliang567 Jul 12, 2023
@yanliang567 yanliang567 added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jul 12, 2023
@yanliang567 yanliang567 added this to the 2.2.12 milestone Jul 12, 2023
@longjiquan longjiquan assigned longjiquan and unassigned czs007 Jul 12, 2023
@yanliang567
Copy link
Contributor

/assign @binbinlv
please help to check it we need a new ci test for this.

@longjiquan
Copy link
Contributor

/unassign

@stale
Copy link

stale bot commented Sep 5, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Rotten issues close after 30d of inactivity. Reopen the issue with /reopen.

@stale stale bot added the stale indicates no udpates for 30 days label Sep 5, 2023
@stale stale bot closed this as completed Sep 12, 2023
@binbinlv
Copy link
Contributor

/reopen

@sre-ci-robot sre-ci-robot reopened this Sep 14, 2023
@sre-ci-robot
Copy link
Contributor

@binbinlv: Reopened this issue.

In response to this:

/reopen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@stale stale bot removed the stale indicates no udpates for 30 days label Sep 14, 2023
@stale
Copy link

stale bot commented Oct 14, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Rotten issues close after 30d of inactivity. Reopen the issue with /reopen.

@stale stale bot added the stale indicates no udpates for 30 days label Oct 14, 2023
@yanliang567
Copy link
Contributor

@binbinlv is it fixed in 2.3?

@stale stale bot removed the stale indicates no udpates for 30 days label Oct 16, 2023
@binbinlv
Copy link
Contributor

binbinlv commented Oct 23, 2023

@binbinlv is it fixed in 2.3?

@yanliang567 Yes, it is good in master-latest:
milvus:master-20231021-d2dbbbc1
pymilvus: 2.3.1.post1.dev14

results:

>>> res = collection.search(data=[[.5,.5]],
...                  anns_field="float_vector",
...                  param={"metric_type": "IP"},
...                  limit = 2,
... )
>>> print(res)
["['pk: 695, distance: 0.9953323602676392, entity: {}', 'pk: 1648, distance: 0.9935095906257629, entity: {}']"]
>>> client = MilvusClient(uri)
>>> res = client.search("test_search_collection_binbin_tmp_0",
...                     [[.5,.5]],
...                     limit=2,
...                     search_params={"metric_type": "IP"},
... )
>>> print(res)
[[{'id': 695, 'distance': 0.9953323602676392, 'entity': {}}, {'id': 1648, 'distance': 0.9935095906257629, 'entity': {}}]]
>>> col = Collection("test_search_collection_binbin_tmp_0")
>>> res = col.search(data=[[.5,.5]],
...                  anns_field="float_vector",
...                  limit = 2,
...                  param={}
... )
>>> print(res)
["['pk: 695, distance: 0.9953323602676392, entity: {}', 'pk: 1648, distance: 0.9935095906257629, entity: {}']"]
>>> client = MilvusClient(uri)
>>> res = client.search("test_search_collection_binbin_tmp_0",
...                     [[.5,.5]],
...                     limit=2,
... )
>>> print(res)
[[{'id': 695, 'distance': 0.9953323602676392, 'entity': {}}, {'id': 1648, 'distance': 0.9935095906257629, 'entity': {}}]]

@binbinlv
Copy link
Contributor

@filip-halt could you please verify on your side? Thanks.

@binbinlv
Copy link
Contributor

/assign @filip-halt

Copy link

stale bot commented Nov 22, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Rotten issues close after 30d of inactivity. Reopen the issue with /reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Issues or changes related a bug stale indicates no udpates for 30 days triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

6 participants