hnswclient

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

A Client to the HNSW service. It provides essential functionalities for managing indices, and inserting and searching vectors.

func New

func New(ctx context.Context, conf config.HNSW) (*Client, error)

New creates a new Client. Once done you should call Client.CloseConnection.

func (*Client) CloseConnection

func (c *Client) CloseConnection() error

CloseConnection closes the underlying gRPC connection.

func (*Client) CreateIndex

func (c *Client) CreateIndex(ctx context.Context, name string) error

CreateIndex creates a new HNSW index.

func (*Client) DeleteIndex

func (c *Client) DeleteIndex(ctx context.Context, name string) error

DeleteIndex deletes an HNSW index.

func (*Client) DeleteIndexIfExists

func (c *Client) DeleteIndexIfExists(ctx context.Context, name string) error

DeleteIndexIfExists deletes an HNSW index only if it exists, otherwise it does nothing.

func (*Client) IndexExists

func (c *Client) IndexExists(ctx context.Context, name string) (bool, error)

IndexExists reports whether an HNSW index exists.

func (*Client) Insert

func (c *Client) Insert(ctx context.Context, indexName string, id uint, vec []float32) error

Insert inserts a vector in the given HNSW index.

func (*Client) SearchKNN

func (c *Client) SearchKNN(indexName string, vector []float32, k int) ([]*Hit, error)

SearchKNN performs K-Nearest Neighbor search.

type Hit

type Hit = grpcapi.Hit

Hit is a single result of KNN search.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL