index

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrVectorIndexAlreadyExists = fmt.Errorf("vector index already exists")
	ErrVectorIndexNotFound      = fmt.Errorf("vector index not found")
)

Functions

func AcceptAll

func AcceptAll(_, _ []float32, _ string) bool

AcceptAll implements SearchFilter by way of accepting all results.

func AcceptNone

func AcceptNone(_, _ []float32, _ string) bool

AcceptNone implements SearchFilter by way of rejecting all results.

func BytesAsFloatArray

func BytesAsFloatArray(encoded []byte, retVal *[]float32)

BytesAsFloatArray(encoded) converts encoded into a []T, where T is either float32 or float64, depending on the value of floatBits. Let floatBytes = floatBits/8. If len(encoded) % floatBytes is not 0, it will ignore any trailing bytes, and simply convert floatBytes bytes at a time to generate the entries. The result is appended to the given retVal slice. If retVal is nil then a new slice is created and appended to.

func BytesToFloat

func BytesToFloat(encoded []byte) float32

Types

type SearchFilter

type SearchFilter func(query, resultVal []float32, resultUID string) bool

SearchFilter defines a predicate function that we will use to determine whether or not a given vector is "interesting". When used in the context of VectorIndex.Search, a true result means that we want to keep the result in the returned list, and a false result implies we should skip.

type SearchPathResult

type SearchPathResult struct {
	// The collection of nearest-neighbors in sorted order after filtering
	// out neighbors that fail any Filter criteria.
	Neighbors []uint64
	// The path from the start of search to the closest neighbor collections.
	Path []uint64
	// A collection of captured named counters that occurred for the
	// particular search.
	Metrics map[string]uint64
}

SearchPathResult is the return-type for the optional SearchWithPath function for a VectorIndex (by way of extending OptionalIndexSupport).

func NewSearchPathResult

func NewSearchPathResult() *SearchPathResult

NewSearchPathResult() provides an initialized (empty) *SearchPathResult. The attributes will be non-nil, but empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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