usearch

package
v1.7.14 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package usearch provides implementation of Go API for https://github.com/unum-cloud/usearch

Package usearch provides Go API implementation for USearch library. https://github.com/unum-cloud/usearch

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*usearch) error

Option represents the functional option for usearch.

func WithConnectivity

func WithConnectivity(connectivity int) Option

WithConnectivity represents the option to set the connectivity for usearch.

func WithDimension

func WithDimension(dim int) Option

WithDimension represents the option to set the dimension for usearch.

func WithExpansionAdd

func WithExpansionAdd(expansionAdd int) Option

WithExpansionAdd represents the option to set the expansion add for usearch.

func WithExpansionSearch

func WithExpansionSearch(expansionSearch int) Option

WithExpansionSearch represents the option to set the expansion search for usearch.

func WithIndexPath

func WithIndexPath(path string) Option

WithIndexPath represents the option to set the index path for usearch.

func WithMetricType

func WithMetricType(metricType string) Option

WithMetricType represents the option to set the metricType for usearch.

func WithMulti

func WithMulti(multi bool) Option

WithMulti represents the option to set the multi for usearch.

func WithQuantizationType

func WithQuantizationType(quantizationType string) Option

WithQuantizationType represents the option to set the quantizationType for usearch.

type Usearch

type Usearch interface {
	// SaveIndex saves the USearch index to storage.
	SaveIndex() error

	// SaveIndexWithPath saves the USearch index to the specified path.
	SaveIndexWithPath(path string) error

	// GetIndicesSize returns the number of vectors in index.
	GetIndicesSize() (indicesSize int, err error)

	// Reserve reserves memory for vectors of given number of arg.
	Reserve(vectorCount int) error

	// Add adds vectors to the USearch index and returns the total count.
	Add(key uint64, vec []float32) error

	// Search performs a nearest neighbor search and returns the results.
	Search(q []float32, k int) ([]algorithm.SearchResult, error)

	// GetObject retruns search result by id as []algorithm.SearchResult.
	GetObject(key core.Key, count int) ([]float32, error)

	// Remove removes vectors from the index by key.
	Remove(key uint64) error

	// Close frees the resources used by the USearch index.
	Close() error
}

Uuearch is the core interface for interacting with usearch index.

func Load

func Load(opts ...Option) (Usearch, error)

func New

func New(opts ...Option) (Usearch, error)

New initializes a new USearch instance with the provided options.

Jump to

Keyboard shortcuts

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