search

package
v0.0.0-...-57e45f5 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: Apache-2.0 Imports: 24 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	IndexShows    = elasticIndex{"bccm-shows"}
	IndexSeasons  = elasticIndex{"bccm-seasons"}
	IndexEpisodes = elasticIndex{"bccm-episodes"}
	Indices       = enum.New(IndexShows, IndexSeasons, IndexEpisodes)
)

Functions

This section is empty.

Types

type AdminFilter

type AdminFilter struct {
	// Groups restricts results to what a member of any of these usergroups can see in the app.
	Groups []string
	// Types are search types ("episode", "season", "show"). Empty means all.
	Types []string
}

AdminFilter narrows an admin search. Add new filters as optional fields with a clause in clauses().

type AdminHit

type AdminHit struct {
	Collection string
	ID         int
	Score      *float64
}

type AdminSearchResult

type AdminSearchResult struct {
	Total int
	Hits  []AdminHit
}

type Config

type Config struct {
	Elastic ElasticConfig
}

Config contains configuration options for the service

type ElasticConfig

type ElasticConfig struct {
	CloudID string
	ApiKey  string

	URL      string
	Username string
	Password string
}

ElasticConfig contains configuration options for the service If CloudID is defined it takes precedence above URL

type Service

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

Service is the type for the service itself

func New

func New(queries *sqlc.Queries, config Config) *Service

New creates a new instance of the search service

func (*Service) AdminSearch

func (service *Service) AdminSearch(ctx context.Context, query string, filter AdminFilter, limit, offset int, languages []string) (AdminSearchResult, error)

AdminSearch returns ranked references only; callers load the entities themselves.

func (*Service) DeleteModel

func (service *Service) DeleteModel(ctx context.Context, collection string, key string) error

DeleteModel from index by collection and id

func (*Service) IndexModel

func (service *Service) IndexModel(ctx context.Context, collection string, key string) (err error)

IndexModel by collection and id

func (*Service) ReindexElastic

func (service *Service) ReindexElastic(ctx context.Context) error

ReindexElastic reindexes all data in elastic

Please note that this will delete all data in elastic first, then recreate it This may not be what we want in the long term but it works for now, and is simple

func (*Service) SearchElastic

func (service *Service) SearchElastic(ctx *gin.Context, query common.SearchQuery, userToken string) (searchResult common.SearchResult, err error)

SearchElastic sends a search query to the engine and returns related results

func (*Service) TopbarSearch

func (service *Service) TopbarSearch(ctx *gin.Context, term string, size int) ([]common.TopbarSearchResult, error)

TopbarSearch performs a search optimized for the topbar dropdown

Jump to

Keyboard shortcuts

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