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

Fix: Index fails to search first inserted vector #22

Closed
wants to merge 1 commit into from

Conversation

miamia0
Copy link

@miamia0 miamia0 commented Feb 19, 2025

I tried using the code below, but the search result is empty.
I attempted to fix the code in this PR to ensure it returns the correct result.

 let hnsw: Hnsw<f32, DistCosine> = Hnsw::new(15, 100_000, 20, 500_000, DistCosine {});
hnsw.insert((&[1.0, 0.0, 0.0, 0.0], 0));
let result = hnsw.search(&[1.0, 0.0, 0.0, 0.0], 2, 10);

@miamia0 miamia0 changed the title Fix: Index Fails to search first Inserted vector Fix: Index fails to search first inserted vector Feb 19, 2025
@miamia0 miamia0 closed this Feb 20, 2025
@jean-pierreBoth
Copy link
Owner

Thanks for the bug. I fixed it somewhat differently

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants