Versions in this module Expand all Collapse all v2 v2.0.0 Mar 18, 2026 Changes in this version + const EnvPrefix + var ErrEmptyVector = errors.New("empty vector") + var ErrWrongDimension = errors.New("vector dimension does not match config") + func EstimateCosine(sig1, sig2 []uint64) float64 + func ExactCosine(v1, v2 []float64) float64 + type Config struct + CosineThreshold float64 + VectorDimensions int + func GetConfigFromEnv() (*Config, error) + func (c *Config) CalculateApproximateThreshold() float64 + func (c *Config) HashVersion(group string) (string, error) + func (c *Config) Validate() error + type Hasher struct + func NewHasher(bands, rows, dimensions int, seed int64) *Hasher + func (h *Hasher) ComputeSignature(vector []float64, sig []uint64) + type Record struct + GroupID string + ID string + Signature []uint64 + Vector []float64 + type Service struct + func NewService(repo repositories.Storage, config *Config) (*Service, error) + func (s *Service) GetNewID(vector []float64) string + func (s *Service) Upsert(ctx context.Context, group string, vector []float64) (string, error) + func (s *Service) WithMetrics(m *lsh.Instruments)