filter

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: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Fix_Count_Type        = "fix"
	Accumulate_Count_Type = "accumulator"
)

Variables

This section is empty.

Functions

func DefaultAdjustNewItemsFunc

func DefaultAdjustNewItemsFunc(filterData *FilterData, retainNum int) []*module.Item

func Filter

func Filter(filterData *FilterData, tag string)

func Load

func Load(config *recconf.RecommendConfig)

func RegisterAdjustNewItemsFunc

func RegisterAdjustNewItemsFunc(f AdjustNewItemsFunc)

func RegisterFilter

func RegisterFilter(name string, filter IFilter)

func RegisterFilterWithConfig

func RegisterFilterWithConfig(config *recconf.RecommendConfig)

Types

type AdjustCountFilter

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

func NewAdjustCountFilter

func NewAdjustCountFilter(config recconf.FilterConfig) *AdjustCountFilter

func (*AdjustCountFilter) Filter

func (f *AdjustCountFilter) Filter(filterData *FilterData) error

type AdjustNewItemsFunc

type AdjustNewItemsFunc func(filterData *FilterData, retainNum int) []*module.Item

type AvgGroupWeightStrategy

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

func (*AvgGroupWeightStrategy) DimensionCount

func (s *AvgGroupWeightStrategy) DimensionCount(dimension string, retainNum int) (count int, exceedNum bool)

func (*AvgGroupWeightStrategy) SetDimensionScoreMap

func (s *AvgGroupWeightStrategy) SetDimensionScoreMap(dimensionScoreMap map[string]float64)

func (*AvgGroupWeightStrategy) TotalScore

func (s *AvgGroupWeightStrategy) TotalScore()

type CompletelyFairCountFilter

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

func NewCompletelyFairCountFilter

func NewCompletelyFairCountFilter(config recconf.FilterConfig) *CompletelyFairCountFilter

func (*CompletelyFairCountFilter) Filter

func (f *CompletelyFairCountFilter) Filter(filterData *FilterData) error

type DimensionFieldUniqueFilter

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

remove duplicate item

func NewDimensionFieldUniqueFilter

func NewDimensionFieldUniqueFilter(config recconf.FilterConfig) *DimensionFieldUniqueFilter

func (*DimensionFieldUniqueFilter) Filter

func (f *DimensionFieldUniqueFilter) Filter(filterData *FilterData) error

func (*DimensionFieldUniqueFilter) MatchTag

func (f *DimensionFieldUniqueFilter) MatchTag(tag string) bool

type FilterData

type FilterData struct {
	Uid          module.UID
	User         *module.User
	Data         interface{}
	Context      *context.RecommendContext
	PipelineName string
}

type FilterService

type FilterService struct {
	Filters map[string][]IFilter
}

func (*FilterService) AddFilter

func (fs *FilterService) AddFilter(scene string, filter IFilter)

func (*FilterService) AddFilters

func (fs *FilterService) AddFilters(scene string, filters []IFilter)

func (*FilterService) Filter

func (fs *FilterService) Filter(filterData *FilterData, tag string)

type GenerateFilterKey

type GenerateFilterKey func(uid module.UID, context *context.RecommendContext) string

function for generate bloom filter key

type GenerateFilterValue

type GenerateFilterValue func(uid module.UID, items []*module.Item, context *context.RecommendContext) [][]byte

function for generate bloom filter values

type GroupWeightCountFilter

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

func NewGroupWeightCountFilter

func NewGroupWeightCountFilter(config recconf.FilterConfig) *GroupWeightCountFilter

func (*GroupWeightCountFilter) Filter

func (f *GroupWeightCountFilter) Filter(filterData *FilterData) error

type GroupWeightStrategy

type GroupWeightStrategy interface {
	SetDimensionScoreMap(dimensionScoreMap map[string]float64)
	TotalScore()
	DimensionCount(dimension string, retainNum int) (count int, exceedNum bool)
}

type IFilter

type IFilter interface {
	Filter(filterData *FilterData) error
}

func GetFilter

func GetFilter(name string) (IFilter, error)

GetFilter get filter by the name

func GetFiltersBySceneName

func GetFiltersBySceneName(sceneName string) ([]IFilter, bool)

type ItemCustomFilter

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

user exposure history filter

func NewItemCustomFilter

func NewItemCustomFilter(config recconf.FilterConfig) *ItemCustomFilter

func (*ItemCustomFilter) Filter

func (f *ItemCustomFilter) Filter(filterData *FilterData) error

type ItemStateFilter

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

func NewItemStateFilter

func NewItemStateFilter(config recconf.FilterConfig) *ItemStateFilter

func (*ItemStateFilter) Filter

func (f *ItemStateFilter) Filter(filterData *FilterData) error

type PriorityAdjustCountFilter

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

func NewPriorityAdjustCountFilter

func NewPriorityAdjustCountFilter(config recconf.FilterConfig) *PriorityAdjustCountFilter

func (*PriorityAdjustCountFilter) Filter

func (f *PriorityAdjustCountFilter) Filter(filterData *FilterData) error

type SoftmaxGroupWeightStrategy

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

func (*SoftmaxGroupWeightStrategy) DimensionCount

func (s *SoftmaxGroupWeightStrategy) DimensionCount(dimension string, retainNum int) (count int, exceedNum bool)

func (*SoftmaxGroupWeightStrategy) SetDimensionScoreMap

func (s *SoftmaxGroupWeightStrategy) SetDimensionScoreMap(dimensionScoreMap map[string]float64)

func (*SoftmaxGroupWeightStrategy) TotalScore

func (s *SoftmaxGroupWeightStrategy) TotalScore()

type UniqueFilter

type UniqueFilter struct {
}

remove duplicate item

func NewUniqueFilter

func NewUniqueFilter() *UniqueFilter

func (*UniqueFilter) Filter

func (f *UniqueFilter) Filter(filterData *FilterData) error

func (*UniqueFilter) MatchTag

func (f *UniqueFilter) MatchTag(tag string) bool

type User2ItemCustomFilter

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

user exposure history filter

func NewUser2ItemCustomFilter

func NewUser2ItemCustomFilter(config recconf.FilterConfig) *User2ItemCustomFilter

func (*User2ItemCustomFilter) Filter

func (f *User2ItemCustomFilter) Filter(filterData *FilterData) error

func (*User2ItemCustomFilter) MatchTag

func (f *User2ItemCustomFilter) MatchTag(tag string) bool

type User2ItemExposureBloomFilter

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

user exposure history filter

func (*User2ItemExposureBloomFilter) Filter

func (f *User2ItemExposureBloomFilter) Filter(filterData *FilterData) error

func (*User2ItemExposureBloomFilter) MatchTag

func (f *User2ItemExposureBloomFilter) MatchTag(tag string) bool

func (*User2ItemExposureBloomFilter) SetFilterActive

func (f *User2ItemExposureBloomFilter) SetFilterActive(flag bool)

func (*User2ItemExposureBloomFilter) SetLogHistoryActive

func (f *User2ItemExposureBloomFilter) SetLogHistoryActive(flag bool)

type User2ItemExposureFilter

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

user exposure history filter

func NewUser2ItemExposureFilter

func NewUser2ItemExposureFilter(config recconf.FilterConfig) *User2ItemExposureFilter

func (*User2ItemExposureFilter) Filter

func (f *User2ItemExposureFilter) Filter(filterData *FilterData) error

func (*User2ItemExposureFilter) MatchTag

func (f *User2ItemExposureFilter) MatchTag(tag string) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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