This library is a rust port of spotify/annoy , currently only index serving is supported.
[dependencies] ru_annoy = "0" ```
```rust use ru_annoy::*;
let index = AnnoyIndex::load(10, "index.ann", IndexType::Angular).unwrap(); let v0 = index.getitemvector(0); let nearest = index.getnearest(v0.asref(), 5, -1, true); ```
It uses JNI bindings to rust crate and is ~5-10x faster than pure java implementation in benchmark scenario
```gradle
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.hanabi1224:RuAnnoy:
kotlin
val index = AnnoyIndex.tryLoad("index.5d.ann", 5, IndexType.Angular)
| Runtimes | Nuget package |
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| RuAnnoy | |
| RuAnnoy-Batteries-Windows-x64 |
|
| RuAnnoy-Batteries-Linux-x64 |
|
| RuAnnoy-Batteries-Darwin-x64 |
|
xml
<ItemGroup>
<PackageReference Include="RuAnnoy" Version="*" />
<PackageReference Include="RuAnnoy-Batteries-Windows-x64" Version="*" />
</ItemGroup>
csharp
var index = AnnoyIndex.Load("index.5d.ann", 5, IndexType.Angular);