module

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Feature_Store_User    = "user"
	Feature_Store_Item    = "item"
	Feature_Type_Sequence = "sequence_feature"
	Feature_Type_RT_Cnt   = "be_rt_cnt_feature"
)
View Source
const (
	REDIS_DATA_TYPE_STRING = "string"
	REDIS_DATA_TYPE_HASH   = "hash"

	REDIS_FIELD_TYPE_CSV  = "csv"
	REDIS_FIELD_TYPE_JSON = "json"
)
View Source
const (
	ITEM = "item"
	USER = "user"
)
View Source
const (
	SQL_User_Filter = "SELECT article_ids FROM %s WHERE user_id='%s'"
	SQL_Item_Filter = "SELECT article_id, article_ids FROM %s WHERE article_id in (%s)"
)
View Source
const (
	SQL_Filter_History = "SELECT article_id FROM %s WHERE uid=? "
	SQL_Insert_History = "INSERT INTO %s (`article_id`, `uid`, `add_time`) VALUES ('%s', '%s', %d)"
	SQL_Delete_History = "DELETE FROM %s WHERE `uid`= '%s';"
)
View Source
const (
	SQL_User_Topic_Filter = "SELECT favorite_topic FROM %s WHERE user_id='%s'"
	SQL_Topic_Item_Filter = "SELECT article_ids FROM %s WHERE topic='%s' ORDER BY publish_time DESC, value DESC LIMIT %d"
)

Variables

View Source
var (
	VectoryEmptyError = errors.New("vector empty")
)

Functions

func FetchPartition

func FetchPartition(hologresName, table, field string) string

func RegisterGenerateItemDataFunc

func RegisterGenerateItemDataFunc(name string, f GenerateItemDataFunc)

Types

type BoostScoreByWeightByWeightHologresDao

type BoostScoreByWeightByWeightHologresDao struct {
	ItemFieldName   string
	WeightFieldName string
	// contains filtered or unexported fields
}

func (*BoostScoreByWeightByWeightHologresDao) GetItems

func (*BoostScoreByWeightByWeightHologresDao) Sort

func (s *BoostScoreByWeightByWeightHologresDao) Sort(items []*Item) []*Item

type BoostScoreByWeightDao

type BoostScoreByWeightDao interface {
	Sort(items []*Item) (resultItems []*Item)
}

func NewBoostScoreByWeightDao

func NewBoostScoreByWeightDao(config recconf.SortConfig) BoostScoreByWeightDao

type ColdStartRecallDao

type ColdStartRecallDao interface {
	ListItemsByUser(user *User, context *context.RecommendContext) []*Item
}

func NewColdStartRecallDao

func NewColdStartRecallDao(config recconf.RecallConfig) ColdStartRecallDao

type ColdStartRecallHologresDao

type ColdStartRecallHologresDao struct {
	// contains filtered or unexported fields
}

func NewColdStartRecallHologresDao

func NewColdStartRecallHologresDao(config recconf.RecallConfig) *ColdStartRecallHologresDao

func (*ColdStartRecallHologresDao) ListItemsByUser

func (d *ColdStartRecallHologresDao) ListItemsByUser(user *User, context *context.RecommendContext) (ret []*Item)

type ContainsFilterOp

type ContainsFilterOp struct {
	Name   string
	Domain string
	Type   string
	Value  interface{}
}

func NewContainsFilterOp

func NewContainsFilterOp(config recconf.FilterParamConfig) *ContainsFilterOp

func (*ContainsFilterOp) ContainsEvaluate

func (p *ContainsFilterOp) ContainsEvaluate(properties map[string]interface{}, userProperties map[string]interface{}, itemProperties map[string]interface{}) (bool, error)

func (*ContainsFilterOp) Evaluate

func (p *ContainsFilterOp) Evaluate(properties map[string]interface{}) (bool, error)

func (*ContainsFilterOp) OpDomain

func (p *ContainsFilterOp) OpDomain() string

type DiversityDao

type DiversityDao interface {
	GetDistinctValue(items []*Item, ctx *context.RecommendContext) error
	GetDistinctFields() []string
}

func NewDiversityDao

func NewDiversityDao(config recconf.FilterConfig) DiversityDao

type DiversityHologresDao

type DiversityHologresDao struct {
	// contains filtered or unexported fields
}

func NewDiversityHologresDao

func NewDiversityHologresDao(config recconf.FilterConfig) *DiversityHologresDao

func (*DiversityHologresDao) GetDistinctFields

func (d *DiversityHologresDao) GetDistinctFields() []string

func (*DiversityHologresDao) GetDistinctValue

func (d *DiversityHologresDao) GetDistinctValue(items []*Item, ctx *pctx.RecommendContext) error

type EmptyFeatureDao

type EmptyFeatureDao struct {
	*FeatureBaseDao
}

func NewEmptyFeatureDao

func NewEmptyFeatureDao(config recconf.FeatureDaoConfig) *EmptyFeatureDao

func (*EmptyFeatureDao) FeatureFetch

func (d *EmptyFeatureDao) FeatureFetch(user *User, items []*Item, context *context.RecommendContext)

type EqualFilterOp

type EqualFilterOp struct {
	Name   string
	Domain string
	Type   string
	Value  interface{}
}

func NewEqualFilterOp

func NewEqualFilterOp(config recconf.FilterParamConfig) *EqualFilterOp

func (*EqualFilterOp) Evaluate

func (p *EqualFilterOp) Evaluate(properties map[string]interface{}) (bool, error)

func (*EqualFilterOp) OpDomain

func (p *EqualFilterOp) OpDomain() string

type FeatureBaseDao

type FeatureBaseDao struct {
	// contains filtered or unexported fields
}

func NewFeatureBaseDao

func NewFeatureBaseDao(config *recconf.FeatureDaoConfig) *FeatureBaseDao

type FeatureBeDao

type FeatureBeDao struct {
	*FeatureBaseDao
	// contains filtered or unexported fields
}

func NewFeatureBeDao

func NewFeatureBeDao(config recconf.FeatureDaoConfig) *FeatureBeDao

func (*FeatureBeDao) FeatureFetch

func (d *FeatureBeDao) FeatureFetch(user *User, items []*Item, context *context.RecommendContext)

type FeatureClickHouseDao

type FeatureClickHouseDao struct {
	*FeatureBaseDao
	// contains filtered or unexported fields
}

func NewFeatureClickHouseDao

func NewFeatureClickHouseDao(config recconf.FeatureDaoConfig) *FeatureClickHouseDao

func (*FeatureClickHouseDao) FeatureFetch

func (d *FeatureClickHouseDao) FeatureFetch(user *User, items []*Item, context *context.RecommendContext)

type FeatureDao

type FeatureDao interface {
	FeatureFetch(user *User, items []*Item, context *context.RecommendContext)
}

FeatureDao is interface, it define FeatureFetch to featch feature from implement

func NewFeatureDao

func NewFeatureDao(config recconf.FeatureDaoConfig) FeatureDao

NewFeatureDao create FeatureDao from config config.AdapterType is decide the implement

type FeatureFeatureStoreDao

type FeatureFeatureStoreDao struct {
	*FeatureBaseDao
	// contains filtered or unexported fields
}

func NewFeatureFeatureStoreDao

func NewFeatureFeatureStoreDao(config recconf.FeatureDaoConfig) *FeatureFeatureStoreDao

func (*FeatureFeatureStoreDao) FeatureFetch

func (d *FeatureFeatureStoreDao) FeatureFetch(user *User, items []*Item, context *context.RecommendContext)

type FeatureHBaseThriftDao

type FeatureHBaseThriftDao struct {
	*FeatureBaseDao
	// contains filtered or unexported fields
}

func NewFeatureHBaseThriftDao

func NewFeatureHBaseThriftDao(config recconf.FeatureDaoConfig) *FeatureHBaseThriftDao

func (*FeatureHBaseThriftDao) FeatureFetch

func (d *FeatureHBaseThriftDao) FeatureFetch(user *User, items []*Item, context *context.RecommendContext)

type FeatureHologresDao

type FeatureHologresDao struct {
	*FeatureBaseDao
	// contains filtered or unexported fields
}

func NewFeatureHologresDao

func NewFeatureHologresDao(config recconf.FeatureDaoConfig) *FeatureHologresDao

func (*FeatureHologresDao) FeatureFetch

func (d *FeatureHologresDao) FeatureFetch(user *User, items []*Item, context *context.RecommendContext)

type FeatureLindormDao

type FeatureLindormDao struct {
	*FeatureBaseDao
	// contains filtered or unexported fields
}

func NewFeatureLindormDao

func NewFeatureLindormDao(config recconf.FeatureDaoConfig) *FeatureLindormDao

func (*FeatureLindormDao) FeatureFetch

func (d *FeatureLindormDao) FeatureFetch(user *User, items []*Item, context *context.RecommendContext)

type FeatureMysqlDao

type FeatureMysqlDao struct {
	*FeatureBaseDao
	// contains filtered or unexported fields
}

func NewFeatureMysqlDao

func NewFeatureMysqlDao(config recconf.FeatureDaoConfig) *FeatureMysqlDao

func (*FeatureMysqlDao) FeatureFetch

func (d *FeatureMysqlDao) FeatureFetch(user *User, items []*Item, context *context.RecommendContext)

type FeatureRedisDao

type FeatureRedisDao struct {
	*FeatureBaseDao
	// contains filtered or unexported fields
}

func NewFeatureRedisDao

func NewFeatureRedisDao(config recconf.FeatureDaoConfig) *FeatureRedisDao

func (*FeatureRedisDao) FeatureFetch

func (d *FeatureRedisDao) FeatureFetch(user *User, items []*Item, context *context.RecommendContext)

type FeatureTablestoreDao

type FeatureTablestoreDao struct {
	*FeatureBaseDao
	// contains filtered or unexported fields
}

func NewFeatureTablestoreDao

func NewFeatureTablestoreDao(config recconf.FeatureDaoConfig) *FeatureTablestoreDao

func (*FeatureTablestoreDao) FeatureFetch

func (d *FeatureTablestoreDao) FeatureFetch(user *User, items []*Item, context *context.RecommendContext)

type FilterOp

type FilterOp interface {
	Evaluate(map[string]interface{}) (bool, error)
	OpDomain() string
}

type FilterParam

type FilterParam struct {
	// contains filtered or unexported fields
}

func NewFilterParamWithConfig

func NewFilterParamWithConfig(configs []recconf.FilterParamConfig) *FilterParam

func (*FilterParam) Evaluate

func (p *FilterParam) Evaluate(properties map[string]interface{}) (bool, error)

func (*FilterParam) EvaluateByDomain

func (p *FilterParam) EvaluateByDomain(userProperties, itemProperties map[string]interface{}) (bool, error)

type GenerateItemDataFunc

type GenerateItemDataFunc func(uid UID, item *Item) string

type GreaterFilterOp

type GreaterFilterOp struct {
	Name   string
	Domain string
	Type   string
	Value  interface{}
}

func NewGreaterFilterOp

func NewGreaterFilterOp(config recconf.FilterParamConfig) *GreaterFilterOp

func (*GreaterFilterOp) Evaluate

func (p *GreaterFilterOp) Evaluate(properties map[string]interface{}) (bool, error)

func (*GreaterFilterOp) OpDomain

func (p *GreaterFilterOp) OpDomain() string

type GreaterThanFilterOp

type GreaterThanFilterOp struct {
	Name   string
	Domain string
	Type   string
	Value  interface{}
}

func NewGreaterThanFilterOp

func NewGreaterThanFilterOp(config recconf.FilterParamConfig) *GreaterThanFilterOp

func (*GreaterThanFilterOp) Evaluate

func (p *GreaterThanFilterOp) Evaluate(properties map[string]interface{}) (bool, error)

func (*GreaterThanFilterOp) OpDomain

func (p *GreaterThanFilterOp) OpDomain() string

type InFilterOp

type InFilterOp struct {
	Name   string
	Domain string
	Type   string
	// contains filtered or unexported fields
}

func NewInFilterOp

func NewInFilterOp(config recconf.FilterParamConfig) *InFilterOp

func (*InFilterOp) Evaluate

func (p *InFilterOp) Evaluate(properties map[string]interface{}) (bool, error)

func (*InFilterOp) OpDomain

func (p *InFilterOp) OpDomain() string

type Item

type Item struct {
	Id         ItemId `json:"id"`
	Name       string `json:"name,omitempty"`
	Score      float64
	RetrieveId string
	ItemType   string
	Embedding  []float64

	Properties map[string]interface{} `json:"properties"`
	// contains filtered or unexported fields
}

func NewItem

func NewItem(id string) *Item

func NewItemWithProperty

func NewItemWithProperty(id string, properties map[string]interface{}) *Item

func (*Item) AddAlgoScore

func (t *Item) AddAlgoScore(name string, score float64)

func (*Item) AddAlgoScores

func (t *Item) AddAlgoScores(scores map[string]float64)

func (*Item) AddProperties

func (t *Item) AddProperties(properties map[string]interface{})

func (*Item) AddProperty

func (t *Item) AddProperty(key string, value interface{})

func (*Item) AddRecallNameFeature

func (t *Item) AddRecallNameFeature()

func (*Item) CloneAlgoScores

func (t *Item) CloneAlgoScores() map[string]float64

func (*Item) DeepClone

func (t *Item) DeepClone() *Item

func (*Item) DeleteProperties

func (t *Item) DeleteProperties(features []string)

func (*Item) DeleteProperty

func (t *Item) DeleteProperty(key string)

func (*Item) ExprData added in v1.0.7

func (t *Item) ExprData() map[string]any

func (*Item) FloatExprData

func (t *Item) FloatExprData(name string) (float64, error)

func (*Item) FloatProperty

func (t *Item) FloatProperty(key string) (float64, error)

func (*Item) GetAlgoScore

func (t *Item) GetAlgoScore(key string) float64

func (*Item) GetAlgoScores

func (t *Item) GetAlgoScores() map[string]float64

func (*Item) GetCloneFeatures

func (t *Item) GetCloneFeatures() map[string]interface{}

func (*Item) GetFeatures

func (t *Item) GetFeatures() map[string]interface{}

func (*Item) GetProperties

func (t *Item) GetProperties() map[string]interface{}

func (*Item) GetProperty

func (t *Item) GetProperty(key string) interface{}

func (*Item) GetRecallName

func (t *Item) GetRecallName() string

func (*Item) IncrAlgoScore

func (t *Item) IncrAlgoScore(name string, score float64)

func (*Item) IntProperty

func (t *Item) IntProperty(key string) (int, error)

func (*Item) StringProperty

func (t *Item) StringProperty(key string) string

type ItemCollaborativeDao

type ItemCollaborativeDao interface {
	ListItemsByItem(item *User, context *context.RecommendContext) []*Item
}

func NewItemCollaborativeDao

func NewItemCollaborativeDao(config recconf.RecallConfig) ItemCollaborativeDao

type ItemCollaborativeHologresDao

type ItemCollaborativeHologresDao struct {
	// contains filtered or unexported fields
}

func NewItemCollaborativeHologresDao

func NewItemCollaborativeHologresDao(config recconf.RecallConfig) *ItemCollaborativeHologresDao

func (*ItemCollaborativeHologresDao) ListItemsByItem

func (d *ItemCollaborativeHologresDao) ListItemsByItem(user *User, context *context.RecommendContext) (ret []*Item)

type ItemCustomFilterDao

type ItemCustomFilterDao interface {
	GetFilterItems() (ret map[ItemId]bool)
}

func NewItemCustomFilterDao

func NewItemCustomFilterDao(config recconf.FilterConfig) ItemCustomFilterDao

type ItemCustomFilterHoloDao

type ItemCustomFilterHoloDao struct {
	// contains filtered or unexported fields
}

func NewItemCustomFilterHoloDao

func NewItemCustomFilterHoloDao(config recconf.FilterConfig) *ItemCustomFilterHoloDao

func (*ItemCustomFilterHoloDao) GetFilterItems

func (i *ItemCustomFilterHoloDao) GetFilterItems() map[ItemId]bool

type ItemCustomFilterTableStoreDao

type ItemCustomFilterTableStoreDao struct {
	// contains filtered or unexported fields
}

func NewItemCustomFilterTableStoreDao

func NewItemCustomFilterTableStoreDao(config recconf.FilterConfig) *ItemCustomFilterTableStoreDao

func (*ItemCustomFilterTableStoreDao) GetFilterItems

func (d *ItemCustomFilterTableStoreDao) GetFilterItems() (ret map[ItemId]bool)

type ItemId

type ItemId string

type ItemScoreSlice

type ItemScoreSlice []*Item

func (ItemScoreSlice) Len

func (us ItemScoreSlice) Len() int

func (ItemScoreSlice) Less

func (us ItemScoreSlice) Less(i, j int) bool

func (ItemScoreSlice) Swap

func (us ItemScoreSlice) Swap(i, j int)

type ItemStateFilterDao

type ItemStateFilterDao interface {
	Filter(user *User, ids []*Item) (ret []*Item)
}

func NewItemStateFilterDao

func NewItemStateFilterDao(config recconf.FilterConfig) ItemStateFilterDao

type ItemStateFilterHBaseThriftDao

type ItemStateFilterHBaseThriftDao struct {
	// contains filtered or unexported fields
}

func NewItemStateFilterHBaseThriftDao

func NewItemStateFilterHBaseThriftDao(config recconf.FilterConfig) *ItemStateFilterHBaseThriftDao

func (*ItemStateFilterHBaseThriftDao) Filter

func (d *ItemStateFilterHBaseThriftDao) Filter(user *User, items []*Item) (ret []*Item)

type ItemStateFilterHologresDao

type ItemStateFilterHologresDao struct {
	// contains filtered or unexported fields
}

func NewItemStateFilterHologresDao

func NewItemStateFilterHologresDao(config recconf.FilterConfig) *ItemStateFilterHologresDao

func (*ItemStateFilterHologresDao) Filter

func (d *ItemStateFilterHologresDao) Filter(user *User, items []*Item) (ret []*Item)

type ItemStateFilterTablestoreDao

type ItemStateFilterTablestoreDao struct {
	// contains filtered or unexported fields
}

func NewItemStateFilterTablestoreDao

func NewItemStateFilterTablestoreDao(config recconf.FilterConfig) *ItemStateFilterTablestoreDao

func (*ItemStateFilterTablestoreDao) Filter

func (d *ItemStateFilterTablestoreDao) Filter(user *User, items []*Item) (ret []*Item)

type LessFilterOp

type LessFilterOp struct {
	Name   string
	Domain string
	Type   string
	Value  interface{}
}

func NewLessFilterOp

func NewLessFilterOp(config recconf.FilterParamConfig) *LessFilterOp

func (*LessFilterOp) Evaluate

func (p *LessFilterOp) Evaluate(properties map[string]interface{}) (bool, error)

func (*LessFilterOp) OpDomain

func (p *LessFilterOp) OpDomain() string

type LessThanFilterOp

type LessThanFilterOp struct {
	Name   string
	Domain string
	Type   string
	Value  interface{}
}

func NewLessThanFilterOp

func NewLessThanFilterOp(config recconf.FilterParamConfig) *LessThanFilterOp

func (*LessThanFilterOp) Evaluate

func (p *LessThanFilterOp) Evaluate(properties map[string]interface{}) (bool, error)

func (*LessThanFilterOp) OpDomain

func (p *LessThanFilterOp) OpDomain() string

type NotContainsFilterOp

type NotContainsFilterOp struct {
	Name   string
	Domain string
	Type   string
	Value  interface{}
}

func NewNotContainsFilterOp

func NewNotContainsFilterOp(config recconf.FilterParamConfig) *NotContainsFilterOp

func (*NotContainsFilterOp) ContainsEvaluate

func (p *NotContainsFilterOp) ContainsEvaluate(properties map[string]interface{}, userProperties map[string]interface{}, itemProperties map[string]interface{}) (bool, error)

func (*NotContainsFilterOp) Evaluate

func (p *NotContainsFilterOp) Evaluate(properties map[string]interface{}) (bool, error)

func (*NotContainsFilterOp) OpDomain

func (p *NotContainsFilterOp) OpDomain() string

type NotEqualFilterOp

type NotEqualFilterOp struct {
	Name   string
	Domain string
	Type   string
	Value  interface{}
}

func NewNotEqualFilterOp

func NewNotEqualFilterOp(config recconf.FilterParamConfig) *NotEqualFilterOp

func (*NotEqualFilterOp) Evaluate

func (p *NotEqualFilterOp) Evaluate(properties map[string]interface{}) (bool, error)

func (*NotEqualFilterOp) OpDomain

func (p *NotEqualFilterOp) OpDomain() string

type NotInFilterOp

type NotInFilterOp struct {
	Name   string
	Domain string
	Type   string
	// contains filtered or unexported fields
}

func NewNotInFilterOp

func NewNotInFilterOp(config recconf.FilterParamConfig) *NotInFilterOp

func (*NotInFilterOp) Evaluate

func (p *NotInFilterOp) Evaluate(properties map[string]interface{}) (bool, error)

func (*NotInFilterOp) NotInEvaluate

func (p *NotInFilterOp) NotInEvaluate(properties map[string]interface{}, userProperties map[string]interface{}, itemProperties map[string]interface{}) (bool, error)

func (*NotInFilterOp) OpDomain

func (p *NotInFilterOp) OpDomain() string

type RTCntField

type RTCntField struct {
	// contains filtered or unexported fields
}

type RealTimeUser2ItemDao

type RealTimeUser2ItemDao interface {
	ListItemsByUser(user *User, context *context.RecommendContext) []*Item
	GetTriggers(user *User, context *context.RecommendContext) map[string]float64
	GetTriggerInfos(user *User, context *context.RecommendContext) []*TriggerInfo
}

func NewRealTimeUser2ItemDao

func NewRealTimeUser2ItemDao(config recconf.RecallConfig) RealTimeUser2ItemDao

type RealtimeUser2ItemBaseDao

type RealtimeUser2ItemBaseDao struct {
	// contains filtered or unexported fields
}

func NewRealtimeUser2ItemBaseDao

func NewRealtimeUser2ItemBaseDao(config *recconf.RecallConfig) *RealtimeUser2ItemBaseDao

func (*RealtimeUser2ItemBaseDao) DiversityTriggers

func (d *RealtimeUser2ItemBaseDao) DiversityTriggers(triggers []*TriggerInfo) []*TriggerInfo

type RealtimeUser2ItemBeDao

type RealtimeUser2ItemBeDao struct {
	*RealtimeUser2ItemBaseDao
	// contains filtered or unexported fields
}

func NewRealtimeUser2ItemBeDao

func NewRealtimeUser2ItemBeDao(config recconf.RecallConfig) *RealtimeUser2ItemBeDao

func (*RealtimeUser2ItemBeDao) GetTriggerInfos

func (d *RealtimeUser2ItemBeDao) GetTriggerInfos(user *User, context *context.RecommendContext) (triggerInfos []*TriggerInfo)

func (*RealtimeUser2ItemBeDao) GetTriggers

func (d *RealtimeUser2ItemBeDao) GetTriggers(user *User, context *context.RecommendContext) (itemTriggers map[string]float64)

func (*RealtimeUser2ItemBeDao) ListItemsByUser

func (d *RealtimeUser2ItemBeDao) ListItemsByUser(user *User, context *context.RecommendContext) (ret []*Item)

type RealtimeUser2ItemHologresDao

type RealtimeUser2ItemHologresDao struct {
	*RealtimeUser2ItemBaseDao
	// contains filtered or unexported fields
}

func NewRealtimeUser2ItemHologresDao

func NewRealtimeUser2ItemHologresDao(config recconf.RecallConfig) *RealtimeUser2ItemHologresDao

func (*RealtimeUser2ItemHologresDao) GetTriggerInfos

func (d *RealtimeUser2ItemHologresDao) GetTriggerInfos(user *User, context *context.RecommendContext) (triggerInfos []*TriggerInfo)

func (*RealtimeUser2ItemHologresDao) GetTriggers

func (d *RealtimeUser2ItemHologresDao) GetTriggers(user *User, context *context.RecommendContext) (itemTriggers map[string]float64)

func (*RealtimeUser2ItemHologresDao) ListItemsByUser

func (d *RealtimeUser2ItemHologresDao) ListItemsByUser(user *User, context *context.RecommendContext) (ret []*Item)

type Trigger

type Trigger struct {
	// contains filtered or unexported fields
}

func NewTrigger

func NewTrigger(triggers []recconf.TriggerConfig) *Trigger

func (*Trigger) GetValue

func (t *Trigger) GetValue(features map[string]interface{}) string

type TriggerDiversityRule

type TriggerDiversityRule struct {
	DiversityRuleConfig recconf.TriggerDiversityRuleConfig
	DimensionItemMap    map[string]string
	DimensionValueSize  map[string]int
}

func (*TriggerDiversityRule) AddDimensionValue

func (r *TriggerDiversityRule) AddDimensionValue(trigger *TriggerInfo, propertyFieldMap map[string]int)

func (*TriggerDiversityRule) GetDimensionValue

func (r *TriggerDiversityRule) GetDimensionValue(trigger *TriggerInfo, propertyFieldMap map[string]int) string

func (*TriggerDiversityRule) Match

func (r *TriggerDiversityRule) Match(trigger *TriggerInfo, propertyFieldMap map[string]int, triggerList []*TriggerInfo) bool

type TriggerInfo

type TriggerInfo struct {
	ItemId string

	Weight float64
	// contains filtered or unexported fields
}

func (*TriggerInfo) StringProperty

func (t *TriggerInfo) StringProperty(dimension string, propertyFieldMap map[string]int) string

type TriggerInfoSlice

type TriggerInfoSlice []*TriggerInfo

func (TriggerInfoSlice) Len

func (us TriggerInfoSlice) Len() int

func (TriggerInfoSlice) Less

func (us TriggerInfoSlice) Less(i, j int) bool

func (TriggerInfoSlice) Swap

func (us TriggerInfoSlice) Swap(i, j int)

type TriggerItem

type TriggerItem struct {
	Key          string
	DefaultValue string
	Boundaries   []int
}

func (*TriggerItem) GetValue

func (tr *TriggerItem) GetValue(feature interface{}) string

type UID

type UID string

type User

type User struct {
	Id UID `json:"uid"`

	Properties map[string]interface{} `json:"properties"`
	// contains filtered or unexported fields
}

func NewUser

func NewUser(id string) *User

func NewUserWithContext

func NewUserWithContext(id UID, context *context.RecommendContext) *User

func (*User) AddCacheFeatures

func (u *User) AddCacheFeatures(key string, features map[string]any)

func (*User) AddProperties

func (u *User) AddProperties(properties map[string]interface{})

func (*User) AddProperty

func (u *User) AddProperty(key string, value interface{})

func (*User) Clone

func (u *User) Clone() *User

func (*User) DeleteProperties

func (u *User) DeleteProperties(features []string)

func (*User) DeleteProperty

func (u *User) DeleteProperty(key string)

func (*User) DescFeatureAsyncLoadCount

func (u *User) DescFeatureAsyncLoadCount(count int32)

func (*User) FeatureAsyncLoadCh

func (u *User) FeatureAsyncLoadCh() <-chan struct{}

func (*User) FeatureAsyncLoadCount

func (u *User) FeatureAsyncLoadCount() int32

func (*User) FloatProperty

func (u *User) FloatProperty(key string) (float64, error)

func (*User) GetCacheFeatures

func (u *User) GetCacheFeatures(key string) (result map[string]interface{})

func (*User) GetCacheFeaturesNames

func (u *User) GetCacheFeaturesNames() (ret []string)

func (*User) GetEmbeddingFeature

func (u *User) GetEmbeddingFeature() (features map[string]interface{})

func (*User) GetProperty

func (u *User) GetProperty(key string) interface{}

func (*User) IncrementFeatureAsyncLoadCount

func (u *User) IncrementFeatureAsyncLoadCount(count int32)

func (*User) IntProperty

func (u *User) IntProperty(key string) (int, error)

func (*User) LoadCacheFeatures

func (u *User) LoadCacheFeatures(key string)

func (*User) MakeUserFeatures

func (u *User) MakeUserFeatures() (features map[string]interface{})

func (*User) MakeUserFeatures2

func (u *User) MakeUserFeatures2() (features map[string]interface{})

MakeUserFeatures2 for easyrec processor

func (*User) SetProperties

func (u *User) SetProperties(p map[string]interface{})

func (*User) StringProperty

func (u *User) StringProperty(key string) string

type User2ItemCustomFilterDao

type User2ItemCustomFilterDao interface {
	Filter(uid UID, ids []*Item) (ret []*Item)
}

func NewUser2ItemCustomFilterDao

func NewUser2ItemCustomFilterDao(config recconf.FilterConfig) User2ItemCustomFilterDao

type User2ItemCustomFilterTableStoreDao

type User2ItemCustomFilterTableStoreDao struct {
	// contains filtered or unexported fields
}

func NewUser2ItemCustomFilterTableStoreDao

func NewUser2ItemCustomFilterTableStoreDao(config recconf.FilterConfig) *User2ItemCustomFilterTableStoreDao

func (*User2ItemCustomFilterTableStoreDao) Filter

func (d *User2ItemCustomFilterTableStoreDao) Filter(uid UID, items []*Item) (ret []*Item)

type User2ItemDao

type User2ItemDao interface {
	ListItemsByUser(user *User, context *context.RecommendContext) []*Item
}

func NewUser2ItemDao

func NewUser2ItemDao(config recconf.RecallConfig) User2ItemDao

type User2ItemExposureBeDao

type User2ItemExposureBeDao struct {
	// contains filtered or unexported fields
}

func NewUser2ItemExposureBeDao

func NewUser2ItemExposureBeDao(config recconf.FilterConfig) *User2ItemExposureBeDao

func (*User2ItemExposureBeDao) ClearHistory

func (d *User2ItemExposureBeDao) ClearHistory(user *User, context *context.RecommendContext)

func (*User2ItemExposureBeDao) FilterByHistory

func (d *User2ItemExposureBeDao) FilterByHistory(uid UID, items []*Item) (ret []*Item)

FilterByHistory filter user expose items. BeEngine already filter itmes, so here no need to filter

func (*User2ItemExposureBeDao) GetExposureItemIds

func (d *User2ItemExposureBeDao) GetExposureItemIds(user *User, context *context.RecommendContext) (ret string)

func (*User2ItemExposureBeDao) LogHistory

func (d *User2ItemExposureBeDao) LogHistory(user *User, items []*Item, context *context.RecommendContext)

type User2ItemExposureDao

type User2ItemExposureDao interface {
	LogHistory(user *User, items []*Item, context *context.RecommendContext)
	FilterByHistory(uid UID, ids []*Item) (ret []*Item)
	ClearHistory(user *User, context *context.RecommendContext)
	GetExposureItemIds(user *User, context *context.RecommendContext) (ret string)
}

func NewUser2ItemExposureDao

func NewUser2ItemExposureDao(config recconf.FilterConfig) User2ItemExposureDao

type User2ItemExposureGraphDao

type User2ItemExposureGraphDao struct {
	// contains filtered or unexported fields
}

func NewUser2ItemExposureGraphDao

func NewUser2ItemExposureGraphDao(config recconf.FilterConfig) *User2ItemExposureGraphDao

func (*User2ItemExposureGraphDao) ClearHistory

func (d *User2ItemExposureGraphDao) ClearHistory(user *User, context *context.RecommendContext)

func (*User2ItemExposureGraphDao) FilterByHistory

func (d *User2ItemExposureGraphDao) FilterByHistory(uid UID, items []*Item) (ret []*Item)

func (*User2ItemExposureGraphDao) GetExposureItemIds

func (d *User2ItemExposureGraphDao) GetExposureItemIds(user *User, context *context.RecommendContext) (ret string)

func (*User2ItemExposureGraphDao) LogHistory

func (d *User2ItemExposureGraphDao) LogHistory(user *User, items []*Item, context *context.RecommendContext)

type User2ItemExposureHologresDao

type User2ItemExposureHologresDao struct {
	// contains filtered or unexported fields
}

func NewUser2ItemExposureHologresDao

func NewUser2ItemExposureHologresDao(config recconf.FilterConfig) *User2ItemExposureHologresDao

func (*User2ItemExposureHologresDao) ClearHistory

func (d *User2ItemExposureHologresDao) ClearHistory(user *User, context *context.RecommendContext)

func (*User2ItemExposureHologresDao) FilterByHistory

func (d *User2ItemExposureHologresDao) FilterByHistory(uid UID, items []*Item) (ret []*Item)

func (*User2ItemExposureHologresDao) GetExposureItemIds

func (d *User2ItemExposureHologresDao) GetExposureItemIds(user *User, context *context.RecommendContext) (ret string)

func (*User2ItemExposureHologresDao) LogHistory

func (d *User2ItemExposureHologresDao) LogHistory(user *User, items []*Item, context *context.RecommendContext)

type User2ItemExposureMysqlDao

type User2ItemExposureMysqlDao struct {
	// contains filtered or unexported fields
}

func NewUser2ItemExposureMysqlDao

func NewUser2ItemExposureMysqlDao(config recconf.FilterConfig) *User2ItemExposureMysqlDao

func (*User2ItemExposureMysqlDao) ClearHistory

func (d *User2ItemExposureMysqlDao) ClearHistory(user *User, context *context.RecommendContext)

func (*User2ItemExposureMysqlDao) FilterByHistory

func (d *User2ItemExposureMysqlDao) FilterByHistory(uid UID, items []*Item) (ret []*Item)

func (*User2ItemExposureMysqlDao) GetExposureItemIds

func (d *User2ItemExposureMysqlDao) GetExposureItemIds(user *User, context *context.RecommendContext) (ret string)

func (*User2ItemExposureMysqlDao) LogHistory

func (d *User2ItemExposureMysqlDao) LogHistory(user *User, items []*Item, context *context.RecommendContext)

type User2ItemExposureRedisDao

type User2ItemExposureRedisDao struct {
	// contains filtered or unexported fields
}

func NewUser2ItemExposureRedisDao

func NewUser2ItemExposureRedisDao(config recconf.FilterConfig) *User2ItemExposureRedisDao

func (*User2ItemExposureRedisDao) ClearHistory

func (d *User2ItemExposureRedisDao) ClearHistory(user *User, context *context.RecommendContext)

func (*User2ItemExposureRedisDao) FilterByHistory

func (d *User2ItemExposureRedisDao) FilterByHistory(uid UID, items []*Item) (ret []*Item)

func (*User2ItemExposureRedisDao) GetExposureItemIds

func (d *User2ItemExposureRedisDao) GetExposureItemIds(user *User, context *context.RecommendContext) (ret string)

func (*User2ItemExposureRedisDao) LogHistory

func (d *User2ItemExposureRedisDao) LogHistory(user *User, items []*Item, context *context.RecommendContext)

type User2ItemExposureTableStoreDao

type User2ItemExposureTableStoreDao struct {
	// contains filtered or unexported fields
}

func NewUser2ItemExposureTableStoreDao

func NewUser2ItemExposureTableStoreDao(config recconf.FilterConfig) *User2ItemExposureTableStoreDao

func (*User2ItemExposureTableStoreDao) ClearHistory

func (d *User2ItemExposureTableStoreDao) ClearHistory(user *User, context *context.RecommendContext)

func (*User2ItemExposureTableStoreDao) FilterByHistory

func (d *User2ItemExposureTableStoreDao) FilterByHistory(uid UID, items []*Item) (ret []*Item)

func (*User2ItemExposureTableStoreDao) GetExposureItemIds

func (d *User2ItemExposureTableStoreDao) GetExposureItemIds(user *User, context *context.RecommendContext) (ret string)

func (*User2ItemExposureTableStoreDao) LogHistory

func (d *User2ItemExposureTableStoreDao) LogHistory(user *User, items []*Item, context *context.RecommendContext)

type User2ItemHologresDao

type User2ItemHologresDao struct {
	// contains filtered or unexported fields
}

func NewUser2ItemHologresDao

func NewUser2ItemHologresDao(config recconf.RecallConfig) *User2ItemHologresDao

func (*User2ItemHologresDao) ListItemsByUser

func (d *User2ItemHologresDao) ListItemsByUser(user *User, context *context.RecommendContext) (ret []*Item)

type UserCollaborativeDao

type UserCollaborativeDao interface {
	ListItemsByUser(user *User, context *context.RecommendContext) []*Item
	GetTriggers(user *User, context *context.RecommendContext) (itemTriggers map[string]float64)
	GetTriggerInfos(user *User, context *context.RecommendContext) (triggerInfos []*TriggerInfo)
}

func NewUserCollaborativeDao

func NewUserCollaborativeDao(config recconf.RecallConfig) UserCollaborativeDao

type UserCollaborativeHologresDao

type UserCollaborativeHologresDao struct {
	// contains filtered or unexported fields
}

func NewUserCollaborativeHologresDao

func NewUserCollaborativeHologresDao(config recconf.RecallConfig) *UserCollaborativeHologresDao

func (*UserCollaborativeHologresDao) GetTriggerInfos

func (d *UserCollaborativeHologresDao) GetTriggerInfos(user *User, context *context.RecommendContext) (triggerInfos []*TriggerInfo)

func (*UserCollaborativeHologresDao) GetTriggers

func (d *UserCollaborativeHologresDao) GetTriggers(user *User, context *context.RecommendContext) (itemTriggers map[string]float64)

func (*UserCollaborativeHologresDao) ListItemsByUser

func (d *UserCollaborativeHologresDao) ListItemsByUser(user *User, context *context.RecommendContext) (ret []*Item)

type UserCollaborativeMysqlDao

type UserCollaborativeMysqlDao struct {
	// contains filtered or unexported fields
}

func NewUserCollaborativeMysqlDao

func NewUserCollaborativeMysqlDao(config recconf.RecallConfig) *UserCollaborativeMysqlDao

func (*UserCollaborativeMysqlDao) GetTriggerInfos

func (d *UserCollaborativeMysqlDao) GetTriggerInfos(user *User, context *context.RecommendContext) (triggerInfos []*TriggerInfo)

func (*UserCollaborativeMysqlDao) GetTriggers

func (d *UserCollaborativeMysqlDao) GetTriggers(user *User, context *context.RecommendContext) (itemTriggers map[string]float64)

func (*UserCollaborativeMysqlDao) ListItemsByUser

func (d *UserCollaborativeMysqlDao) ListItemsByUser(user *User, context *context.RecommendContext) (ret []*Item)

type UserCollaborativeRedisDao

type UserCollaborativeRedisDao struct {
	// contains filtered or unexported fields
}

func NewUserCollaborativeRedisDao

func NewUserCollaborativeRedisDao(config recconf.RecallConfig) *UserCollaborativeRedisDao

func (*UserCollaborativeRedisDao) GetTriggerInfos

func (d *UserCollaborativeRedisDao) GetTriggerInfos(user *User, context *context.RecommendContext) (triggerInfos []*TriggerInfo)

func (*UserCollaborativeRedisDao) GetTriggers

func (d *UserCollaborativeRedisDao) GetTriggers(user *User, context *context.RecommendContext) (itemTriggers map[string]float64)

func (*UserCollaborativeRedisDao) ListItemsByUser

func (d *UserCollaborativeRedisDao) ListItemsByUser(user *User, context *context.RecommendContext) (ret []*Item)

type UserCollaborativeTableStoreDao

type UserCollaborativeTableStoreDao struct {
	// contains filtered or unexported fields
}

func NewUserCollaborativeTableStoreDao

func NewUserCollaborativeTableStoreDao(config recconf.RecallConfig) *UserCollaborativeTableStoreDao

func (*UserCollaborativeTableStoreDao) GetTriggerInfos

func (d *UserCollaborativeTableStoreDao) GetTriggerInfos(user *User, context *context.RecommendContext) (triggerInfos []*TriggerInfo)

func (*UserCollaborativeTableStoreDao) GetTriggers

func (d *UserCollaborativeTableStoreDao) GetTriggers(user *User, context *context.RecommendContext) (itemTriggers map[string]float64)

func (*UserCollaborativeTableStoreDao) ListItemsByUser

func (d *UserCollaborativeTableStoreDao) ListItemsByUser(user *User, context *context.RecommendContext) (ret []*Item)

type UserCustomRecallClickHouseDao

type UserCustomRecallClickHouseDao struct {
	// contains filtered or unexported fields
}

func NewUserCusteomRecallClickHouseDao

func NewUserCusteomRecallClickHouseDao(config recconf.RecallConfig) *UserCustomRecallClickHouseDao

func (*UserCustomRecallClickHouseDao) ListItemsByUser

func (d *UserCustomRecallClickHouseDao) ListItemsByUser(user *User, context *context.RecommendContext) (ret []*Item)

type UserCustomRecallDao

type UserCustomRecallDao interface {
	ListItemsByUser(user *User, context *context.RecommendContext) []*Item
}

func NewUserCustomRecallDao

func NewUserCustomRecallDao(config recconf.RecallConfig) UserCustomRecallDao

type UserCustomRecallHologresDao

type UserCustomRecallHologresDao struct {
	// contains filtered or unexported fields
}

func NewUserCusteomRecallHologresDao

func NewUserCusteomRecallHologresDao(config recconf.RecallConfig) *UserCustomRecallHologresDao

func (*UserCustomRecallHologresDao) ListItemsByUser

func (d *UserCustomRecallHologresDao) ListItemsByUser(user *User, context *context.RecommendContext) (ret []*Item)

type UserCustomRecallMysqlDao

type UserCustomRecallMysqlDao struct {
	// contains filtered or unexported fields
}

func NewUserCusteomRecallMysqlDao

func NewUserCusteomRecallMysqlDao(config recconf.RecallConfig) *UserCustomRecallMysqlDao

func (*UserCustomRecallMysqlDao) ListItemsByUser

func (d *UserCustomRecallMysqlDao) ListItemsByUser(user *User, context *context.RecommendContext) (ret []*Item)

type UserCustomRecallRedisDao

type UserCustomRecallRedisDao struct {
	// contains filtered or unexported fields
}

func NewUserCusteomRecallRedisDao

func NewUserCusteomRecallRedisDao(config recconf.RecallConfig) *UserCustomRecallRedisDao

func (*UserCustomRecallRedisDao) ListItemsByUser

func (d *UserCustomRecallRedisDao) ListItemsByUser(user *User, context *context.RecommendContext) (ret []*Item)

type UserCustomRecallTableStoreDao

type UserCustomRecallTableStoreDao struct {
	// contains filtered or unexported fields
}

func NewUserCustomRecallTableStoreDao

func NewUserCustomRecallTableStoreDao(config recconf.RecallConfig) *UserCustomRecallTableStoreDao

func (*UserCustomRecallTableStoreDao) ListItemsByUser

func (d *UserCustomRecallTableStoreDao) ListItemsByUser(user *User, context *context.RecommendContext) (ret []*Item)

type UserGlobalHotRecallDao

type UserGlobalHotRecallDao interface {
	ListItemsByUser(user *User, context *context.RecommendContext) []*Item
}

func NewUserGlobalHotRecallDao

func NewUserGlobalHotRecallDao(config recconf.RecallConfig) UserGlobalHotRecallDao

type UserGlobalHotRecallHologresDao

type UserGlobalHotRecallHologresDao struct {
	// contains filtered or unexported fields
}

func NewUserGlobalHotRecallHologresDao

func NewUserGlobalHotRecallHologresDao(config recconf.RecallConfig) *UserGlobalHotRecallHologresDao

func (*UserGlobalHotRecallHologresDao) ListItemsByUser

func (d *UserGlobalHotRecallHologresDao) ListItemsByUser(user *User, context *context.RecommendContext) (ret []*Item)

type UserGlobalHotRecallTableStoreDao

type UserGlobalHotRecallTableStoreDao struct {
	// contains filtered or unexported fields
}

func NewUserGlobalHotRecallTableStoreDao

func NewUserGlobalHotRecallTableStoreDao(config recconf.RecallConfig) *UserGlobalHotRecallTableStoreDao

func (*UserGlobalHotRecallTableStoreDao) ListItemsByUser

func (d *UserGlobalHotRecallTableStoreDao) ListItemsByUser(user *User, context *context.RecommendContext) (ret []*Item)

type UserGroupHotRecallDao

type UserGroupHotRecallDao interface {
	ListItemsByUser(user *User, context *context.RecommendContext) []*Item
}

func NewUserGroupHotRecallDao

func NewUserGroupHotRecallDao(config recconf.RecallConfig) UserGroupHotRecallDao

type UserGroupHotRecallHologresDao

type UserGroupHotRecallHologresDao struct {
	// contains filtered or unexported fields
}

func NewUserGroupHotRecallHologresDao

func NewUserGroupHotRecallHologresDao(config recconf.RecallConfig) *UserGroupHotRecallHologresDao

func (*UserGroupHotRecallHologresDao) ListItemsByUser

func (d *UserGroupHotRecallHologresDao) ListItemsByUser(user *User, context *context.RecommendContext) (ret []*Item)

type UserTopicDao

type UserTopicDao interface {
	ListItemsByUser(user *User, context *context.RecommendContext) []*Item
}

func NewUserTopicDao

func NewUserTopicDao(config recconf.RecallConfig) UserTopicDao

type UserTopicMysqlDao

type UserTopicMysqlDao struct {
	// contains filtered or unexported fields
}

func NewUserTopicMysqlDao

func NewUserTopicMysqlDao(config recconf.RecallConfig) *UserTopicMysqlDao

func (*UserTopicMysqlDao) ListItemsByUser

func (d *UserTopicMysqlDao) ListItemsByUser(user *User, context *context.RecommendContext) (ret []*Item)

type UserTopicTableStoreDao

type UserTopicTableStoreDao struct {
	// contains filtered or unexported fields
}

func NewUserTopicTableStoreDao

func NewUserTopicTableStoreDao(config recconf.RecallConfig) *UserTopicTableStoreDao

func (*UserTopicTableStoreDao) ListItemsByUser

func (d *UserTopicTableStoreDao) ListItemsByUser(user *User, context *context.RecommendContext) (ret []*Item)

type UserVideoCollaborativeMysqlDao

type UserVideoCollaborativeMysqlDao struct {
	// contains filtered or unexported fields
}

func NewUserVideoCollaborativeMysqlDao

func NewUserVideoCollaborativeMysqlDao(config recconf.RecallConfig) *UserVideoCollaborativeMysqlDao

func (*UserVideoCollaborativeMysqlDao) GetTriggerInfos

func (d *UserVideoCollaborativeMysqlDao) GetTriggerInfos(user *User, context *context.RecommendContext) (triggerInfos []*TriggerInfo)

func (*UserVideoCollaborativeMysqlDao) GetTriggers

func (d *UserVideoCollaborativeMysqlDao) GetTriggers(user *User, context *context.RecommendContext) (itemTriggers map[string]float64)

func (*UserVideoCollaborativeMysqlDao) ListItemsByUser

func (d *UserVideoCollaborativeMysqlDao) ListItemsByUser(user *User, context *context.RecommendContext) (ret []*Item)

type VectorBeDao

type VectorBeDao struct {
	// contains filtered or unexported fields
}

func NewVectorBeDao

func NewVectorBeDao(config recconf.RecallConfig) *VectorBeDao

func (*VectorBeDao) VectorString

func (d *VectorBeDao) VectorString(id string) (string, error)

type VectorClickHouseDao

type VectorClickHouseDao struct {
	// contains filtered or unexported fields
}

func NewVectorClickHouseDao

func NewVectorClickHouseDao(config recconf.RecallConfig) *VectorClickHouseDao

func (*VectorClickHouseDao) VectorString

func (d *VectorClickHouseDao) VectorString(id string) (string, error)

type VectorDao

type VectorDao interface {
	VectorString(id string) (string, error)
}

func NewVectorDao

func NewVectorDao(config recconf.RecallConfig) VectorDao

type VectorHBaseDao

type VectorHBaseDao struct {
	// contains filtered or unexported fields
}

VectorHBaseDao is hbase implement of vector dao

func NewVectorHBaseDao

func NewVectorHBaseDao(config recconf.RecallConfig) *VectorHBaseDao

NewVectorHBaseDao create new VectorHBaseDao

func (*VectorHBaseDao) VectorString

func (d *VectorHBaseDao) VectorString(id string) (string, error)

VectorString get data from hbase by id key returns vector of string

type VectorHologresDao

type VectorHologresDao struct {
	// contains filtered or unexported fields
}

func NewVectorHologresDao

func NewVectorHologresDao(config recconf.RecallConfig) *VectorHologresDao

NewVectorHologresDao create new VectorHologresDao

func (*VectorHologresDao) VectorString

func (d *VectorHologresDao) VectorString(id string) (string, error)

returns vector of string

type VectorMysqlDao

type VectorMysqlDao struct {
	// contains filtered or unexported fields
}

func NewVectorMysqlDao

func NewVectorMysqlDao(config recconf.RecallConfig) *VectorMysqlDao

func (*VectorMysqlDao) VectorString

func (d *VectorMysqlDao) VectorString(id string) (string, error)

type VectorRedisDao

type VectorRedisDao struct {
	// contains filtered or unexported fields
}

func NewVectorRedisDao

func NewVectorRedisDao(config recconf.RecallConfig) *VectorRedisDao

func (*VectorRedisDao) VectorString

func (d *VectorRedisDao) VectorString(id string) (string, error)

Source Files

Jump to

Keyboard shortcuts

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