Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// M is the maximum number of neighbors to keep for each node.
// The number of layer 0 is 2*M.
M uint32
// Ml is the level generation factor.
Ml float32
// EfSearch is the number of nodes to consider in the search phase.
EfSearch uint32
// EfConstruct is the number of nodes to consider in the construct phase.
EfConstruct uint32
}
type Dependencies ¶
type Dependencies struct{}
type Factory ¶
type Factory component.Factory[Index, Config, Dependencies]
--- Factory code block ---
func NewFactory ¶
func NewFactory(mockOn ...component.MockOption) Factory
type Index ¶
type Index interface {
component.Component
index.Codec
// Search returns feed IDs with vectors similar to the query vector.
// If any chunk of the feed is similar to the query vector, the feed is returned.
// And the score is the maximum score of the chunks.
// But results may miss some similar feeds.
// The result is a map of feed IDs to their similarity scores.
// Score is in range [0, 1].
Search(ctx context.Context, q []float32, threshold float32, limit int) (idWithScores map[uint64]float32, err error)
// Add adds feed vectors to the index.
// A feed may be split into multiple chunks, and each chunk is a vector.
Add(ctx context.Context, id uint64, vectors [][]float32) (err error)
}
--- Interface code block ---
Click to show internal directories.
Click to hide internal directories.