{"id":14240776,"url":"https://github.com/djc/instant-distance","last_synced_at":"2025-12-12T14:38:39.522Z","repository":{"id":40562199,"uuid":"321386930","full_name":"djc/instant-distance","owner":"djc","description":"Fast approximate nearest neighbor searching in Rust, based on HNSW index","archived":false,"fork":false,"pushed_at":"2025-11-24T07:52:19.000Z","size":225,"stargazers_count":337,"open_issues_count":5,"forks_count":30,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-12-06T00:37:46.946Z","etag":null,"topics":["approximate-nearest-neighbor-search","hnsw","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/djc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["djc"],"patreon":"dochtman"}},"created_at":"2020-12-14T15:15:27.000Z","updated_at":"2025-11-24T07:52:16.000Z","dependencies_parsed_at":"2023-02-17T19:45:24.782Z","dependency_job_id":"ba247bd6-440a-4c65-bcec-4a1e1acb1b38","html_url":"https://github.com/djc/instant-distance","commit_stats":{"total_commits":233,"total_committers":10,"mean_commits":23.3,"dds":"0.12446351931330468","last_synced_commit":"944bf9bcca06b55efe910789cbbb6b19dc4e0aba"},"previous_names":["instantdomain/instant-distance","djc/instant-distance"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/djc/instant-distance","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djc%2Finstant-distance","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djc%2Finstant-distance/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djc%2Finstant-distance/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djc%2Finstant-distance/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/djc","download_url":"https://codeload.github.com/djc/instant-distance/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djc%2Finstant-distance/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27684833,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-12T02:00:06.775Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["approximate-nearest-neighbor-search","hnsw","rust"],"created_at":"2024-08-21T10:01:49.987Z","updated_at":"2025-12-12T14:38:39.505Z","avatar_url":"https://github.com/djc.png","language":"Rust","funding_links":["https://github.com/sponsors/djc","https://patreon.com/dochtman"],"categories":["Rust","Search"],"sub_categories":[],"readme":"![Cover logo](./cover.svg)\n\n# Instant Distance: fast HNSW indexing\n\n[![Build status](https://github.com/InstantDomain/instant-distance/workflows/CI/badge.svg)](https://github.com/InstantDomain/instant-distance/actions?query=workflow%3ACI)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE-MIT)\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE-APACHE)\n\nInstance Distance is a fast pure-Rust implementation of the [Hierarchical\nNavigable Small Worlds paper][paper] by Malkov and Yashunin for finding\napproximate nearest neighbors. This implementation powers the\n[Instant Domain Search][domains] backend services used for word vector indexing.\n\n## What it does\n\nInstant Distance is an implementation of a fast approximate nearest neighbor\nsearch algorithm. The algorithm is used to find the closest point(s) to a given\npoint in a set. As one example, it can be used to make [simple translations][translations].\n\n## Using the library\n\n### Rust\n\n```toml\n[dependencies]\ninstant-distance = \"0.5.0\"\n```\n\n## Example\n\n```rust\nuse instant_distance::{Builder, Search};\n\nfn main() {\n    let points = vec![Point(255, 0, 0), Point(0, 255, 0), Point(0, 0, 255)];\n    let values = vec![\"red\", \"green\", \"blue\"];\n\n    let map = Builder::default().build(points, values);\n    let mut search = Search::default();\n\n    let cambridge_blue = Point(163, 193, 173);\n\n    let closest_point = map.search(\u0026cambridge_blue, \u0026mut search).next().unwrap();\n\n    println!(\"{:?}\", closest_point.value);\n}\n\n#[derive(Clone, Copy, Debug)]\nstruct Point(isize, isize, isize);\n\nimpl instant_distance::Point for Point {\n    fn distance(\u0026self, other: \u0026Self) -\u003e f32 {\n        // Euclidean distance metric\n        (((self.0 - other.0).pow(2) + (self.1 - other.1).pow(2) + (self.2 - other.2).pow(2)) as f32)\n            .sqrt()\n    }\n}\n```\n\n## Testing\n\nRust:\n\n```\ncargo t -p instant-distance --all-features\n```\n\nPython:\n\n```\nmake test-python\n```\n\n[paper]: https://arxiv.org/abs/1603.09320\n[domains]: https://instantdomainsearch.com/\n[translations]: https://instantdomains.com/engineering/how-to-use-fasttext-for-instant-translations\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjc%2Finstant-distance","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdjc%2Finstant-distance","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjc%2Finstant-distance/lists"}