search

package
v0.0.0-...-20e6d49 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2025 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrServiceStopped = eris.New("search service is stopped")
	ErrStartupFailed  = eris.New("search service failed to start")
)

Functions

This section is empty.

Types

type Request

type Request struct {
	Query       string   `json:"query"`
	Types       []string `json:"types"`
	Limit       int      `json:"limit"`
	Offset      int      `json:"offset"`
	RequesterID pulid.ID `json:"requester_id"`
	OrgID       pulid.ID `json:"org_id"`
	BuID        pulid.ID `json:"bu_id"`
}

type Response

type Response struct {
	Results []*infra.SearchDocument `json:"results"`
	Total   int                     `json:"total"`
	Query   string                  `json:"query"`
}

type Service

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

func NewService

func NewService(p ServiceParams) (*Service, error)

func (*Service) Index

func (s *Service) Index(ctx context.Context, entity infra.SearchableEntity) error

func (*Service) Search

func (s *Service) Search(ctx context.Context, params *Request) (*Response, error)

func (*Service) Start

func (s *Service) Start() error

func (*Service) Stop

func (s *Service) Stop(ctx context.Context) error

type ServiceParams

type ServiceParams struct {
	fx.In

	LC     fx.Lifecycle
	Client infra.SearchClient
	Config *config.Manager
	Logger *logger.Logger
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳