Documentation ¶
Index ¶
- func CalculateAverage(avg []float64, p []float64, n float64) []float64
- func CloneResult(result []*pb.ScoredDatum) []*pb.ScoredDatum
- func CosineSimilarity(a []float64, b []float64) float64
- func DefaultSearchConfig() *pb.SearchConfig
- func EncodeSearchConfig(p *pb.SearchConfig) []byte
- func GetKeyAsBytes(datum *pb.Datum) ([]byte, error)
- func GetSearchKey(datum *pb.Datum, config *pb.SearchConfig) string
- func GetValueAsBytes(datum *pb.Datum) ([]byte, error)
- func GetVectorComparisonFunction(name string) func(arr1 []float64, arr2 []float64) float64
- func InsertConfigFromExpireAt(expiresAt uint64) *pb.InsertConfig
- func NewDatum(feature []float64, dim1 uint32, dim2 uint32, size1 uint32, size2 uint32, ...) *pb.Datum
- func QuickVectorDistance(arr1 []float64, arr2 []float64) float64
- func ToDatum(key, value []byte) (*pb.Datum, error)
- func ToDatumKey(byteArray []byte) (*pb.DatumKey, error)
- func ToDatumValue(byteArray []byte) (*pb.DatumValue, error)
- func VectorDistance(arr1 []float64, arr2 []float64) float64
- func VectorMultiplication(arr1 []float64, arr2 []float64) float64
- type Aggregator
- func (a *Aggregator) BestScore(scoredDatum *pb.ScoredDatum) float64
- func (a *Aggregator) Insert(scoredDatum *pb.ScoredDatum) error
- func (a *Aggregator) InsertToList(scoredDatum *pb.ScoredDatum) error
- func (a *Aggregator) IsNewScoredBetter(old, new float64) bool
- func (a *Aggregator) One() *pb.ScoredDatum
- func (a *Aggregator) Result() []*pb.ScoredDatum
- type AggregatorInterface
- type Collector
- type Data
- func (dt *Data) AddSource(dataSource DataSource)
- func (dt *Data) AggregatedSearch(datum *pb.Datum, scoredDatumStreamOutput chan<- *pb.ScoredDatum, ...) error
- func (dt *Data) Close() error
- func (dt *Data) Delete(datum *pb.Datum) error
- func (dt *Data) DeletePath() error
- func (d *Data) GetConfig() *pb.DataConfig
- func (dt *Data) GetDataInfo() *pb.DataInfo
- func (dt *Data) GetID() string
- func (dt *Data) InitData() error
- func (dt *Data) Insert(datum *pb.Datum, config *pb.InsertConfig) error
- func (dt *Data) InsertStreamSample(datumStream chan<- *pb.InsertDatumWithConfig, fraction float64) error
- func (dt *Data) MultiAggregatedSearch(datumList []*pb.Datum, config *pb.SearchConfig, context *pb.SearchContext) ([]*pb.ScoredDatum, error)
- func (dt *Data) Process(force bool) error
- func (dt *Data) Run() error
- func (dt *Data) Search(datum *pb.Datum, config *pb.SearchConfig) *Collector
- func (dt *Data) StreamAll(datumStream chan<- *pb.Datum) error
- func (dt *Data) StreamSample(datumStream chan<- *pb.Datum, fraction float64) error
- func (dt *Data) StreamSearch(datum *pb.Datum, scoredDatumStream chan<- *pb.ScoredDatum, ...) error
- func (dt *Data) Sync(source DataSource, waitGroup *sync.WaitGroup) error
- func (dt *Data) SyncAll() error
- type DataSource
- type Dataset
- func (dts *Dataset) Close() error
- func (dts *Dataset) CreateIfNotExists(config *pb.DataConfig) error
- func (dts *Dataset) DataConfigList() []*pb.DataConfig
- func (dts *Dataset) Delete(name string) error
- func (dts *Dataset) Get(name string) (*Data, error)
- func (dts *Dataset) GetOrCreateIfNotExists(config *pb.DataConfig) (*Data, error)
- func (dts *Dataset) List() []string
- func (dts *Dataset) LoadIndex() error
- func (dts *Dataset) SaveIndex() error
- type InsertStreamCollector
- type StreamCollector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateAverage ¶
CalculateAverage calculates average of two arrays divided by n
func CloneResult ¶ added in v0.0.30
func CloneResult(result []*pb.ScoredDatum) []*pb.ScoredDatum
func CosineSimilarity ¶ added in v0.0.23
CosineSimilarity for vector similarity
func DefaultSearchConfig ¶ added in v0.0.22
func DefaultSearchConfig() *pb.SearchConfig
func EncodeSearchConfig ¶ added in v0.0.22
func EncodeSearchConfig(p *pb.SearchConfig) []byte
func GetSearchKey ¶ added in v0.0.22
func GetSearchKey(datum *pb.Datum, config *pb.SearchConfig) string
func GetVectorComparisonFunction ¶ added in v0.0.23
func InsertConfigFromExpireAt ¶ added in v0.0.22
func InsertConfigFromExpireAt(expiresAt uint64) *pb.InsertConfig
func NewDatum ¶ added in v0.0.22
func NewDatum(feature []float64, dim1 uint32, dim2 uint32, size1 uint32, size2 uint32, groupLabel []byte, label []byte, version uint64, ) *pb.Datum
NewDatum is an utily function to initialize datum type
func QuickVectorDistance ¶ added in v0.0.30
func ToDatumValue ¶ added in v0.0.22
func ToDatumValue(byteArray []byte) (*pb.DatumValue, error)
func VectorDistance ¶
VectorDistance calculates distance of two vector by euclidean distance
func VectorMultiplication ¶ added in v0.0.22
VectorMultiplication calculates elementwise of multiplication of two vectors
Types ¶
type Aggregator ¶ added in v0.0.23
type Aggregator struct { Config *pb.SearchConfig List []*pb.ScoredDatum DeDuplicationMap *cache.Cache Grouped bool Context *pb.SearchContext ScoreFunc func(arr1 []float64, arr2 []float64) float64 }
func (*Aggregator) BestScore ¶ added in v0.0.23
func (a *Aggregator) BestScore(scoredDatum *pb.ScoredDatum) float64
func (*Aggregator) Insert ¶ added in v0.0.23
func (a *Aggregator) Insert(scoredDatum *pb.ScoredDatum) error
func (*Aggregator) InsertToList ¶ added in v0.0.23
func (a *Aggregator) InsertToList(scoredDatum *pb.ScoredDatum) error
func (*Aggregator) IsNewScoredBetter ¶ added in v0.0.23
func (a *Aggregator) IsNewScoredBetter(old, new float64) bool
func (*Aggregator) One ¶ added in v0.0.23
func (a *Aggregator) One() *pb.ScoredDatum
func (*Aggregator) Result ¶ added in v0.0.23
func (a *Aggregator) Result() []*pb.ScoredDatum
type AggregatorInterface ¶ added in v0.0.23
type AggregatorInterface interface { Insert(*pb.ScoredDatum) error One() *pb.ScoredDatum Result() []*pb.ScoredDatum }
func NewAggrator ¶ added in v0.0.23
func NewAggrator(config *pb.SearchConfig, grouped bool, context *pb.SearchContext) AggregatorInterface
type Collector ¶ added in v0.0.22
type Collector struct { List []*pb.ScoredDatum ScoreFunc func(arr1 []float64, arr2 []float64) float64 MaxScore float64 DatumKey *pb.DatumKey N uint32 HigherIsBetter bool Filters []string GroupFilters []string }
Collector collects results
func (*Collector) Insert ¶ added in v0.0.22
func (c *Collector) Insert(scoredDatum *pb.ScoredDatum) error
Insert add a new scored datum to collector
type Data ¶
type Data struct { Config *pb.DataConfig Path string Avg []float64 N uint64 MaxDistance float64 Hist []float64 Timestamp uint64 DB *badger.DB DBPath string Dirty bool Sources *cache.Cache QueryCache *cache.Cache Initialized bool }
Data represents a dataset with similar struture
func NewData ¶
func NewData(config *pb.DataConfig, dataPath string) (*Data, error)
NewData creates a data struct
func NewPreData ¶ added in v0.0.22
func NewPreData(config *pb.DataConfig, dataPath string) *Data
NewPreData creates a data struct
func (*Data) AddSource ¶ added in v0.0.22
func (dt *Data) AddSource(dataSource DataSource)
AddSource adds a source
func (*Data) AggregatedSearch ¶ added in v0.0.23
func (dt *Data) AggregatedSearch(datum *pb.Datum, scoredDatumStreamOutput chan<- *pb.ScoredDatum, upperWaitGroup *sync.WaitGroup, config *pb.SearchConfig) error
AggregatedSearch searches and merges other resources
func (*Data) DeletePath ¶ added in v0.0.25
Delete currently deletes underlying data folder ignores errors.
func (*Data) GetConfig ¶ added in v0.0.22
func (d *Data) GetConfig() *pb.DataConfig
func (*Data) GetDataInfo ¶ added in v0.0.22
GetDataInfo out of data
func (*Data) InsertStreamSample ¶ added in v0.0.22
func (dt *Data) InsertStreamSample(datumStream chan<- *pb.InsertDatumWithConfig, fraction float64) error
func (*Data) MultiAggregatedSearch ¶ added in v0.0.23
func (dt *Data) MultiAggregatedSearch(datumList []*pb.Datum, config *pb.SearchConfig, context *pb.SearchContext) ([]*pb.ScoredDatum, error)
MultiAggregatedSearch searches and merges other resources
func (*Data) StreamSample ¶ added in v0.0.22
func (*Data) StreamSearch ¶ added in v0.0.22
func (dt *Data) StreamSearch(datum *pb.Datum, scoredDatumStream chan<- *pb.ScoredDatum, queryWaitGroup *sync.WaitGroup, config *pb.SearchConfig) error
StreamSearch does a search based on distances of keys
type DataSource ¶ added in v0.0.22
type Dataset ¶ added in v0.0.22
func NewDataset ¶ added in v0.0.22
func (*Dataset) CreateIfNotExists ¶ added in v0.0.22
func (dts *Dataset) CreateIfNotExists(config *pb.DataConfig) error
func (*Dataset) DataConfigList ¶ added in v0.0.22
func (dts *Dataset) DataConfigList() []*pb.DataConfig
func (*Dataset) GetOrCreateIfNotExists ¶ added in v0.0.22
func (dts *Dataset) GetOrCreateIfNotExists(config *pb.DataConfig) (*Data, error)
type InsertStreamCollector ¶ added in v0.0.22
type InsertStreamCollector struct {
DatumStream chan<- *pb.InsertDatumWithConfig
}
InsertStreamCollector collects results
type StreamCollector ¶ added in v0.0.22
StreamCollector collects results