Documentation
¶
Index ¶
- Constants
- func AssertTrue(b bool)
- func BytesToUint64(bytes []byte) uint64
- func Check(err error)
- func ConcatStrings(strs ...string) string
- func CreateFactory[T c.Float](floatBits int) index.IndexFactory[T]
- func DataKey(attr string, uid uint64) []byte
- func EuclideanDistanceSq[T c.Float](a, b []T, floatBits int) (T, error)
- func GetPersistantOptions[T c.Float](o opt.Options) string
- func ParseEdges(s string) ([]uint64, error)
- func ParseNamespaceBytes(attr string) ([]byte, string)
- func Uint64ToBytes(key uint64) []byte
- func UpdateIndexSplit[T c.Float](vi index.VectorIndex[T], split int) error
- type HeapDataHolder
- type QueryCache
- type SearchResult
- type SimilarityType
- type TxnCache
Constants ¶
const ( Euclidean = "euclidean" Cosine = "cosine" DotProd = "dotproduct" EmptyHNSWTreeError = "HNSW tree has no elements" VecKeyword = "__vector_" VecEntry = "__vector_entry" VecDead = "__vector_dead" VectorIndexMaxLevels = 5 EfConstruction = 16 EfSearch = 12 // ByteData indicates the key stores data. ByteData = byte(0x00) // DefaultPrefix is the prefix used for data, index and reverse keys so that relative DefaultPrefix = byte(0x00) // NsSeparator is the separator between the namespace and attribute. NsSeparator = "-" )
Variables ¶
This section is empty.
Functions ¶
func AssertTrue ¶
func AssertTrue(b bool)
AssertTrue asserts that b is true. Otherwise, it would log fatal.
func BytesToUint64 ¶
func ConcatStrings ¶
func CreateFactory ¶
func CreateFactory[T c.Float](floatBits int) index.IndexFactory[T]
CreateFactory creates an instance of the private struct persistentIndexFactory. NOTE: if T and floatBits do not match in # of bits, there will be consequences.
func DataKey ¶
DataKey generates a data key with the given attribute and UID. The structure of a data key is as follows:
byte 0: key type prefix (set to DefaultPrefix or ByteSplit if part of a multi-part list) byte 1-2: length of attr next len(attr) bytes: value of attr next byte: data type prefix (set to ByteData) next eight bytes: value of uid next eight bytes (optional): if the key corresponds to a split list, the startUid of the split stored in this key and the first byte will be sets to ByteSplit.
func ParseEdges ¶
func ParseNamespaceBytes ¶
func Uint64ToBytes ¶
func UpdateIndexSplit ¶
Types ¶
type HeapDataHolder ¶
type HeapDataHolder struct {
// contains filtered or unexported fields
}
func (HeapDataHolder) Len ¶
func (h HeapDataHolder) Len() int
Len is the number of elements in the collection.
func (HeapDataHolder) Less ¶
func (h HeapDataHolder) Less(i, j int) bool
Less reports whether the element with index i should sort before the element with index j.
func (*HeapDataHolder) Pop ¶
func (h *HeapDataHolder) Pop() interface{}
Pop removes and returns the maximum element from the heap.
func (*HeapDataHolder) Push ¶
func (h *HeapDataHolder) Push(x interface{})
Push adds an element to the heap.
func (HeapDataHolder) Swap ¶
func (h HeapDataHolder) Swap(i, j int)
Swap swaps the elements with indexes i and j.
type QueryCache ¶
type QueryCache struct {
// contains filtered or unexported fields
}
QueryCache implements index.CacheType interface
func NewQueryCache ¶
func NewQueryCache(cache index.LocalCache, readTs uint64) *QueryCache
func (*QueryCache) Ts ¶
func (qc *QueryCache) Ts() uint64
type SearchResult ¶
type SearchResult struct {
// contains filtered or unexported fields
}
func (*SearchResult) GetExtraMetrics ¶
func (s *SearchResult) GetExtraMetrics() map[string]uint64
func (*SearchResult) GetNnUids ¶
func (s *SearchResult) GetNnUids() []uint64
func (*SearchResult) GetTraversalPath ¶
func (s *SearchResult) GetTraversalPath() []uint64
type SimilarityType ¶
TODO: Move SimilarityType to index package.
Remove "hnsw-isms".
func GetSimType ¶
func GetSimType[T c.Float](indexType string, floatBits int) SimilarityType[T]