recommendations

package
v0.0.5-37 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const COLLECTION_DATE_FIELD = `coalesce(c.properties->>'start_date', c.created_at::text)::date`
View Source
const DATE_FIELD = `coalesce(cu.properties->>'film_date', cu.properties->>'start_date', cu.created_at::text)::date`
View Source
const FILTER_LESSON_PREP = `and not(cu.type_id = %d and (cu.properties->>'part')::int = 0 and (cu.properties->>'duration')::int < 1200)`

Filter out all content units which are lesson preps, e.g., part 0 which is shorter then 20 minutes (1200 seconds).

Variables

This section is empty.

Functions

func LastContentUnitsSameCollectionGenSql

func LastContentUnitsSameCollectionGenSql(request core.MoreRequest) string

func MakeContentTypeSuggester

func MakeContentTypeSuggester(db *sql.DB, contentTypes []string, suggesters []core.Suggester) core.Suggester

func MakeDefaultSuggester

func MakeDefaultSuggester(suggesterContext core.SuggesterContext) (*core.Suggester, error)

func PrevContentUnitsSameCollectionGenSql

func PrevContentUnitsSameCollectionGenSql(request core.MoreRequest) string

Types

type CollectionsSuggester

type CollectionsSuggester struct {
	SqlSuggester
	// contains filtered or unexported fields
}

func MakeCollectionsSuggester

func MakeCollectionsSuggester(db *sql.DB, filters []core.SuggesterFilter, orderSelector core.OrderSelectorEnum) *CollectionsSuggester

func (*CollectionsSuggester) MarshalSpec

func (suggester *CollectionsSuggester) MarshalSpec() (core.SuggesterSpec, error)

func (*CollectionsSuggester) UnmarshalSpec

func (suggester *CollectionsSuggester) UnmarshalSpec(suggesterContext core.SuggesterContext, spec core.SuggesterSpec) error

type ContentTypeSuggester

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

func (*ContentTypeSuggester) MarshalSpec

func (suggester *ContentTypeSuggester) MarshalSpec() (core.SuggesterSpec, error)

func (*ContentTypeSuggester) More

func (*ContentTypeSuggester) UnmarshalSpec

func (suggester *ContentTypeSuggester) UnmarshalSpec(suggesterContext core.SuggesterContext, spec core.SuggesterSpec) error

type ContentTypesSameTagSuggester

type ContentTypesSameTagSuggester struct {
	SqlSuggester
	// contains filtered or unexported fields
}

func MakeContentTypesSameTagSuggester

func MakeContentTypesSameTagSuggester(db *sql.DB, contentTypes []string, orderSelector core.OrderSelectorEnum) *ContentTypesSameTagSuggester

func (*ContentTypesSameTagSuggester) MarshalSpec

func (suggester *ContentTypesSameTagSuggester) MarshalSpec() (core.SuggesterSpec, error)

func (*ContentTypesSameTagSuggester) UnmarshalSpec

func (suggester *ContentTypesSameTagSuggester) UnmarshalSpec(suggesterContext core.SuggesterContext, spec core.SuggesterSpec) error

type ContentUnitCollectionSuggester

type ContentUnitCollectionSuggester struct {
	SqlSuggester
	// contains filtered or unexported fields
}

func MakeContentUnitCollectionSuggester

func MakeContentUnitCollectionSuggester(db *sql.DB, contentTypes []string) *ContentUnitCollectionSuggester

func (*ContentUnitCollectionSuggester) MarshalSpec

func (suggester *ContentUnitCollectionSuggester) MarshalSpec() (core.SuggesterSpec, error)

func (*ContentUnitCollectionSuggester) UnmarshalSpec

func (suggester *ContentUnitCollectionSuggester) UnmarshalSpec(suggesterContext core.SuggesterContext, spec core.SuggesterSpec) error

type ContentUnitRecommendInfo

type ContentUnitRecommendInfo struct {
	data_models.ContentUnitInfo
	Tags    []string
	Sources []string
}

func LoadContentUnitRecommendInfo

func LoadContentUnitRecommendInfo(uid string, suggesterContext core.SuggesterContext) (*ContentUnitRecommendInfo, error)

type ContentUnitsSuggester

type ContentUnitsSuggester struct {
	SqlSuggester
	// contains filtered or unexported fields
}

func MakeContentUnitsSuggester

func MakeContentUnitsSuggester(db *sql.DB, filters []core.SuggesterFilter, orderSelector core.OrderSelectorEnum) *ContentUnitsSuggester

func (*ContentUnitsSuggester) MarshalSpec

func (suggester *ContentUnitsSuggester) MarshalSpec() (core.SuggesterSpec, error)

func (*ContentUnitsSuggester) UnmarshalSpec

func (suggester *ContentUnitsSuggester) UnmarshalSpec(suggesterContext core.SuggesterContext, spec core.SuggesterSpec) error

type DataCollectionsSuggester

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

func MakeDataCollectionsSuggester

func MakeDataCollectionsSuggester(suggesterContext core.SuggesterContext, filters []core.SuggesterFilter, orderSelector core.OrderSelectorEnum) *DataCollectionsSuggester

func (*DataCollectionsSuggester) MarshalSpec

func (s *DataCollectionsSuggester) MarshalSpec() (core.SuggesterSpec, error)

func (*DataCollectionsSuggester) More

func (*DataCollectionsSuggester) UnmarshalSpec

func (s *DataCollectionsSuggester) UnmarshalSpec(suggesterContext core.SuggesterContext, spec core.SuggesterSpec) error

type DataContentUnitsSuggester

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

func MakeDataContentUnitsSuggester

func MakeDataContentUnitsSuggester(suggesterContext core.SuggesterContext, filters []core.SuggesterFilter, orderSelector core.OrderSelectorEnum) *DataContentUnitsSuggester

func (*DataContentUnitsSuggester) MarshalSpec

func (s *DataContentUnitsSuggester) MarshalSpec() (core.SuggesterSpec, error)

func (*DataContentUnitsSuggester) More

func (*DataContentUnitsSuggester) UnmarshalSpec

func (s *DataContentUnitsSuggester) UnmarshalSpec(suggesterContext core.SuggesterContext, spec core.SuggesterSpec) error

type GenerateSqlFunc

type GenerateSqlFunc func(request core.MoreRequest) string

func CollectionsSqlGen

func CollectionsSqlGen(filters []core.SuggesterFilter, orderSelector core.OrderSelectorEnum) GenerateSqlFunc

func ContentTypesSameTagGen

func ContentTypesSameTagGen(contentTypes []string, orderSelector core.OrderSelectorEnum) GenerateSqlFunc

func ContentUnitCollectionGen

func ContentUnitCollectionGen(contentTypes []string) GenerateSqlFunc

func ContentUnitsSqlGen

func ContentUnitsSqlGen(filters []core.SuggesterFilter, orderSelector core.OrderSelectorEnum) GenerateSqlFunc

func LastCollectionContentTypesSameTag

func LastCollectionContentTypesSameTag(contentTypes []string) GenerateSqlFunc

func LastCollectionSameSource

func LastCollectionSameSource(contentTypes []string) GenerateSqlFunc

func LastContentUnitsContentTypesGenSql

func LastContentUnitsContentTypesGenSql(contentTypes []string) GenerateSqlFunc

func NextContentUnitsSameSourceGenSql

func NextContentUnitsSameSourceGenSql(contentTypes []string) GenerateSqlFunc

func PrevContentUnitsSameSourceGenSql

func PrevContentUnitsSameSourceGenSql(contentTypes []string) GenerateSqlFunc

func RandomContentTypes

func RandomContentTypes(contentTypes []string, tagUids []string) GenerateSqlFunc

func RandomContentUnitsSameSourceGenSql

func RandomContentUnitsSameSourceGenSql(contentTypes []string, tagUids []string) GenerateSqlFunc

type LastClipsSuggester

type LastClipsSuggester struct {
	SqlSuggester
}

func MakeLastClipsSuggester

func MakeLastClipsSuggester(db *sql.DB) *LastClipsSuggester

func (*LastClipsSuggester) MarshalSpec

func (suggester *LastClipsSuggester) MarshalSpec() (core.SuggesterSpec, error)

func (*LastClipsSuggester) UnmarshalSpec

func (suggester *LastClipsSuggester) UnmarshalSpec(suggesterContext core.SuggesterContext, spec core.SuggesterSpec) error

type LastCollectionSameSourceSuggester

type LastCollectionSameSourceSuggester struct {
	SqlSuggester
	// contains filtered or unexported fields
}

func MakeLastCollectionSameSourceSuggester

func MakeLastCollectionSameSourceSuggester(db *sql.DB, contentTypes []string) *LastCollectionSameSourceSuggester

func (*LastCollectionSameSourceSuggester) MarshalSpec

func (suggester *LastCollectionSameSourceSuggester) MarshalSpec() (core.SuggesterSpec, error)

func (*LastCollectionSameSourceSuggester) UnmarshalSpec

func (suggester *LastCollectionSameSourceSuggester) UnmarshalSpec(suggesterContext core.SuggesterContext, spec core.SuggesterSpec) error

type LastContentTypesSameTagSuggester

type LastContentTypesSameTagSuggester struct {
	SqlSuggester
	// contains filtered or unexported fields
}

func MakeLastClipsSameTagSuggester

func MakeLastClipsSameTagSuggester(db *sql.DB) *LastContentTypesSameTagSuggester

func MakeLastCongressSameTagSuggester

func MakeLastCongressSameTagSuggester(db *sql.DB) *LastContentTypesSameTagSuggester

func MakeLastContentTypesSameTagSuggester

func MakeLastContentTypesSameTagSuggester(db *sql.DB, contentTypes []string) *LastContentTypesSameTagSuggester

func MakeLastProgramsSameTagSuggester

func MakeLastProgramsSameTagSuggester(db *sql.DB) *LastContentTypesSameTagSuggester

func (*LastContentTypesSameTagSuggester) MarshalSpec

func (suggester *LastContentTypesSameTagSuggester) MarshalSpec() (core.SuggesterSpec, error)

func (*LastContentTypesSameTagSuggester) UnmarshalSpec

func (suggester *LastContentTypesSameTagSuggester) UnmarshalSpec(suggesterContext core.SuggesterContext, spec core.SuggesterSpec) error

type LastContentUnitsSameCollectionSuggester

type LastContentUnitsSameCollectionSuggester struct {
	SqlSuggester
}

func MakeLastContentUnitsSameCollectionSuggester

func MakeLastContentUnitsSameCollectionSuggester(db *sql.DB) *LastContentUnitsSameCollectionSuggester

func (*LastContentUnitsSameCollectionSuggester) MarshalSpec

func (*LastContentUnitsSameCollectionSuggester) UnmarshalSpec

func (suggester *LastContentUnitsSameCollectionSuggester) UnmarshalSpec(suggesterContext core.SuggesterContext, spec core.SuggesterSpec) error

type LastContentUnitsSuggester

type LastContentUnitsSuggester struct {
	SqlSuggester
}

func MakeLastContentUnitsSuggester

func MakeLastContentUnitsSuggester(db *sql.DB) *LastContentUnitsSuggester

func (*LastContentUnitsSuggester) MarshalSpec

func (suggester *LastContentUnitsSuggester) MarshalSpec() (core.SuggesterSpec, error)

func (*LastContentUnitsSuggester) UnmarshalSpec

func (suggester *LastContentUnitsSuggester) UnmarshalSpec(suggesterContext core.SuggesterContext, spec core.SuggesterSpec) error

type LastLessonsSameTagSuggester

type LastLessonsSameTagSuggester struct {
	core.RoundRobinSuggester
}

func MakeLastLessonsSameTagSuggester

func MakeLastLessonsSameTagSuggester(db *sql.DB) *LastLessonsSameTagSuggester

func (*LastLessonsSameTagSuggester) MarshalSpec

func (suggester *LastLessonsSameTagSuggester) MarshalSpec() (core.SuggesterSpec, error)

func (*LastLessonsSameTagSuggester) UnmarshalSpec

func (suggester *LastLessonsSameTagSuggester) UnmarshalSpec(suggesterContext core.SuggesterContext, spec core.SuggesterSpec) error

type LastLessonsSuggester

type LastLessonsSuggester struct {
	SqlSuggester
}

func MakeLastLessonsSuggester

func MakeLastLessonsSuggester(db *sql.DB) *LastLessonsSuggester

func (*LastLessonsSuggester) MarshalSpec

func (suggester *LastLessonsSuggester) MarshalSpec() (core.SuggesterSpec, error)

func (*LastLessonsSuggester) UnmarshalSpec

func (suggester *LastLessonsSuggester) UnmarshalSpec(suggesterContext core.SuggesterContext, spec core.SuggesterSpec) error

type LastProgramsSuggester

type LastProgramsSuggester struct {
	SqlSuggester
}

func MakeLastProgramsSuggester

func MakeLastProgramsSuggester(db *sql.DB) *LastProgramsSuggester

func (*LastProgramsSuggester) MarshalSpec

func (suggester *LastProgramsSuggester) MarshalSpec() (core.SuggesterSpec, error)

func (*LastProgramsSuggester) UnmarshalSpec

func (suggester *LastProgramsSuggester) UnmarshalSpec(suggesterContext core.SuggesterContext, spec core.SuggesterSpec) error

type NextContentUnitsSameSourceSuggester

type NextContentUnitsSameSourceSuggester struct {
	SqlSuggester
	// contains filtered or unexported fields
}

func MakeNextContentUnitsSameSourceSuggester

func MakeNextContentUnitsSameSourceSuggester(db *sql.DB, contentTypes []string) *NextContentUnitsSameSourceSuggester

func (*NextContentUnitsSameSourceSuggester) MarshalSpec

func (suggester *NextContentUnitsSameSourceSuggester) MarshalSpec() (core.SuggesterSpec, error)

func (*NextContentUnitsSameSourceSuggester) UnmarshalSpec

func (suggester *NextContentUnitsSameSourceSuggester) UnmarshalSpec(suggesterContext core.SuggesterContext, spec core.SuggesterSpec) error

type PrevContentUnitsSameCollectionSuggester

type PrevContentUnitsSameCollectionSuggester struct {
	SqlSuggester
}

func MakePrevContentUnitsSameCollectionSuggester

func MakePrevContentUnitsSameCollectionSuggester(db *sql.DB) *PrevContentUnitsSameCollectionSuggester

func (*PrevContentUnitsSameCollectionSuggester) MarshalSpec

func (*PrevContentUnitsSameCollectionSuggester) UnmarshalSpec

func (suggester *PrevContentUnitsSameCollectionSuggester) UnmarshalSpec(suggesterContext core.SuggesterContext, spec core.SuggesterSpec) error

type PrevContentUnitsSameSourceSuggester

type PrevContentUnitsSameSourceSuggester struct {
	SqlSuggester
	// contains filtered or unexported fields
}

func MakePrevContentUnitsSameSourceSuggester

func MakePrevContentUnitsSameSourceSuggester(db *sql.DB, contentTypes []string) *PrevContentUnitsSameSourceSuggester

func (*PrevContentUnitsSameSourceSuggester) MarshalSpec

func (suggester *PrevContentUnitsSameSourceSuggester) MarshalSpec() (core.SuggesterSpec, error)

func (*PrevContentUnitsSameSourceSuggester) UnmarshalSpec

func (suggester *PrevContentUnitsSameSourceSuggester) UnmarshalSpec(suggesterContext core.SuggesterContext, spec core.SuggesterSpec) error

type RandomContentTypesSuggester

type RandomContentTypesSuggester struct {
	SqlSuggester
	// contains filtered or unexported fields
}

func MakeRandomContentTypesSuggester

func MakeRandomContentTypesSuggester(db *sql.DB, contentTypes []string, tagUids []string) *RandomContentTypesSuggester

func (*RandomContentTypesSuggester) MarshalSpec

func (suggester *RandomContentTypesSuggester) MarshalSpec() (core.SuggesterSpec, error)

func (*RandomContentTypesSuggester) UnmarshalSpec

func (suggester *RandomContentTypesSuggester) UnmarshalSpec(suggesterContext core.SuggesterContext, spec core.SuggesterSpec) error

type RandomContentUnitsSameSourceSuggester

type RandomContentUnitsSameSourceSuggester struct {
	SqlSuggester
	// contains filtered or unexported fields
}

func MakeRandomContentUnitsSameSourceSuggester

func MakeRandomContentUnitsSameSourceSuggester(db *sql.DB, contentTypes []string, tagUids []string) *RandomContentUnitsSameSourceSuggester

func (*RandomContentUnitsSameSourceSuggester) MarshalSpec

func (suggester *RandomContentUnitsSameSourceSuggester) MarshalSpec() (core.SuggesterSpec, error)

func (*RandomContentUnitsSameSourceSuggester) UnmarshalSpec

func (suggester *RandomContentUnitsSameSourceSuggester) UnmarshalSpec(suggesterContext core.SuggesterContext, spec core.SuggesterSpec) error

type Recommender

type Recommender struct {
	Suggester core.Suggester
}

func MakeRecommender

func MakeRecommender(suggesterContext core.SuggesterContext) (*Recommender, error)

func (*Recommender) Recommend

func (recommender *Recommender) Recommend(r core.MoreRequest) ([]core.ContentItem, error)

type SqlSuggester

type SqlSuggester struct {
	Name string
	// contains filtered or unexported fields
}

func (*SqlSuggester) More

func (s *SqlSuggester) More(request core.MoreRequest) ([]core.ContentItem, error)

Jump to

Keyboard shortcuts

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