searchdb

package
v0.9.14 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

This package handles the retrieval of data from the CouchDB search database Synchronization is handled by triggers in the database using the http postgresql extension, without the need for postgres->application->couchdb->app->postgres- round trip (we need to store the returned document id to ensure deduplication)

Index

Constants

View Source
const (
	Members           targetDBName = "members"
	Artists           targetDBName = "artists"
	Ratings           targetDBName = "ratings"
	Genres            targetDBName = "genres"
	GenreDescriptions targetDBName = "genre_descriptions"
	// aka keywords
	Studios targetDBName = "studio"
	MediaDB targetDBName = "media"
)

Variables

nolint:gochecknoglobals

Functions

This section is empty.

Types

type Artist

type Artist struct {
	ID        string    `json:"_id"`
	Rev       string    `json:"_rev"`
	Name      string    `json:"name"`
	Nicknames string    `json:"nick_names"`
	Bio       string    `json:"bio"`
	Added     time.Time `json:"added"`
	Modified  time.Time `json:"modified"`
}

type Genre

type Genre struct {
	ID           string               `json:"_id"`
	Rev          string               `json:"_rev"`
	Name         string               `json:"name"`
	Kinds        []string             `json:"kinds"`
	Descriptions [][]GenreDescription `json:"descriptions"`
}

Those types are simplified representations of what is stored in postgres that are written on insert/update to couchdb

type GenreDescription

type GenreDescription struct {
	Description string `json:"description"`
	Language    string `json:"language"`
}

type Media

type Media struct {
	ID    string `json:"_id"`
	Rev   string `json:"_rev"`
	Title string `json:"title"`
	Kind  string `json:"kind"`
	// Created refers to the release date
	Created  time.Time `json:"created"`
	Added    time.Time `json:"added"`
	Modified time.Time `json:"modified"`
}

type Member

type Member struct {
	ID          string `json:"_id"`
	Rev         string `json:"_rev"`
	Bio         string `json:"bio,omitempty"`
	Webfinger   string `json:"webfinger,omitempty"`
	DisplayName string `json:"display_name,omitempty"`
}

type Rating

type Rating struct {
	ID         string `json:"_id"`
	Rev        string `json:"_rev"`
	Topic      string `json:"topic"`
	Body       string `json:"body"`
	User       string `json:"user"`
	MediaTitle string `json:"media_title"`
	// not sure whether this shouldn't actually be a string as well
	Added    time.Time `json:"added"`
	Modified time.Time `json:"modified"`
}

type Storage

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

func Connect

func Connect(config *cfg.Search, log *zerolog.Logger) (*Storage, error)

func (*Storage) ReadAll

func (s *Storage) ReadAll(ctx context.Context, target TargetDB) (data []interface{}, err error)

we only care about scanning the data into it's raw JSON representation so that we can then use it for indexing

func (*Storage) ReadArtists

func (s *Storage) ReadArtists(ctx context.Context) (data []Artist, err error)

func (*Storage) ReadGenres

func (s *Storage) ReadGenres(ctx context.Context) (data []Genre, err error)

func (*Storage) ReadMedia

func (s *Storage) ReadMedia(ctx context.Context) (data []Media, err error)

func (*Storage) ReadMembers

func (s *Storage) ReadMembers(ctx context.Context) (data []Member, err error)

func (*Storage) ReadNew

func (s *Storage) ReadNew(
	ctx context.Context,
	outgoingDataFeed chan interface{},
	continuousMode bool,
) (err error)

ReadNew handles the cyclical or continuous retrieval of new documents for indexing. This function does not accept a target parameter, since it doesn't make much sense to only look for partial data. The channel parameter here is used to communicate data to the search indexer

func (*Storage) ReadRatings

func (s *Storage) ReadRatings(ctx context.Context) (data []Rating, err error)

func (*Storage) ReadStudios

func (s *Storage) ReadStudios(ctx context.Context) (data []Studio, err error)

type Studio

type Studio struct {
	ID       string    `json:"_id"`
	Rev      string    `json:"_rev"`
	Name     string    `json:"name"`
	Kind     string    `json:"kind"`
	CityUUID string    `json:"city"`
	Added    time.Time `json:"added"`
	Modified time.Time `json:"modified"`
}

type TargetDB

type TargetDB interface {
	String() string
}

Jump to

Keyboard shortcuts

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