Skip to content

sunhailin-Leo/hnswlib-to-go

Repository files navigation

hnswlib-to-go

Hnswlib to go. Golang interface to hnswlib(https://github.com/nmslib/hnswlib). This is a golang interface of hnswlib. For more information, please follow hnswlib and Efficient and robust approximate nearest neighbor search using Hierarchical Navigable Small World graphs..

But in this project, we make compatible hnswlib to 0.7.0.

Version

  • version 1.0.4

    • Add UpdatePoint, UpdateBatchPoints APIs
  • version 1.0.3

    • Add GetMaxElements, GetCurrentElementCount, GetDeleteCount, GetVectorByLabel APIs
  • version 1.0.2

    • Update hnswlib compatible version to 0.7.0
    • Add AddBatchPoints, SearchBatchKNN, SetNormalize, ResizeIndex, MarkDelete, UnmarkDelete, GetLabelIsMarkedDeleted API
  • version 1.0.1

    • Code format
    • Add an api support unload the graph(Experimental)
  • version 1.0.0

    • hnswlib compatible version 0.5.2.

Build

  • Linux/MacOS
    • Build Golang Env
    • go mod init
    • make

Usage

  • When building golang program, please add export CGO_CXXFLAGS=-std=c++11 command before go build / run / test ...
argument type
dim int vector dimension
M int seeALGO_PARAMS.md
efConstruction int seeALGO_PARAMS.md
randomSeed int random seed for hnsw
maxElements int max records in data
spaceType str
spaceType distance
ip inner product
cosine cosine similarity
l2 l2