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

Incorrect knn search by doc id #428

Closed
5 tasks
Nick-S-2018 opened this issue Dec 24, 2024 · 3 comments
Closed
5 tasks

Incorrect knn search by doc id #428

Nick-S-2018 opened this issue Dec 24, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@Nick-S-2018
Copy link
Contributor

Bug Description:

Now the knn doc id search test is failing in the php client, which may relate to the recent changes made in #417
@donhardman, can you please check if this is really the case?

Here are the responses for the same http request received from the dev and last release versions, respectively:

curl localhost:9308/search -d '{"index":"test","knn":{"field":"test_vector","doc_id":3,"k":5}}'
{"took":9,"timed_out":false,"hits":{"total":6,"total_relation":"eq","hits":[{"_id":4,"_score":1,"_knn_dist":0.050000,"_source":{"test_vector":[0.300000,0.500000]}},{"_id":5,"_score":1,"_knn_dist":0.130000,"_source":{"test_vector":[0.500000,0.500000]}},{"_id":2,"_score":1,"_knn_dist":0.160000,"_source":{"test_vector":[0.200000,0.300000]}},{"_id":6,"_score":1,"_knn_dist":0.500000,"_source":{"test_vector":[0.700000,0.200000]}},{"_id":10,"_score":1,"_knn_dist":0.530000,"_source":{"test_vector":[0.900000,0.900000]}}]}}
curl localhost:9308/search -d '{"index":"test","knn":{"field":"test_vector","doc_id":3,"k":5}}'
{"took":130,"timed_out":false,"hits":{"total":6,"total_relation":"eq","hits":[{"_id":3,"_score":1,"_knn_dist":0.000000,"_source":{"test_vector":[0.200000,0.700000]}},{"_id":4,"_score":1,"_knn_dist":0.05000000,"_source":{"test_vector":[0.300000,0.500000]}},{"_id":5,"_score":1,"_knn_dist":0.130000,"_source":{"test_vector":[0.500000,0.500000]}},{"_id":2,"_score":1,"_knn_dist":0.15999998,"_source":{"test_vector":[0.200000,0.300000]}},{"_id":6,"_score":1,"_knn_dist":0.500000,"_source":{"test_vector":[0.700000,0.200000]}},{"_id":10,"_score":1,"_knn_dist":0.530000,"_source":{"test_vector":[0.900000,0.900000]}}]}

A test table can be created with:

create table test ( test_vector float_vector knn_type='hnsw' knn_dims='2' hnsw_similarity='l2' );
insert into test values ( 2, (0.2,0.3) ), ( 3, (0.2,0.7) ), ( 4, (0.3,0.5) ), ( 5, (0.5,0.5) ), ( 6, (0.7,0.2) ), ( 10, (0.9,0.9) );

Manticore Search Version:

dev

Operating System Version:

Ubuntu 22.04 LTS

Have you tried the latest development version?

None

Internal Checklist:

To be completed by the assignee. Check off tasks that have been completed or are not applicable.

  • Implementation completed
  • Tests developed
  • Documentation updated
  • Documentation reviewed
  • Changelog updated
@Nick-S-2018 Nick-S-2018 added the bug Something isn't working label Dec 24, 2024
@donhardman
Copy link
Collaborator

Fix implemented: #433

@donhardman
Copy link
Collaborator

Please let me know if it fixes the issue

@donhardman donhardman assigned Nick-S-2018 and unassigned donhardman Jan 8, 2025
@Nick-S-2018
Copy link
Contributor Author

Yes, the issue is fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants