meili

package
v0.9.18 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options added in v0.9.16

type Options struct {
	// Query is the search query used for a text search.
	Query string `json:"query" query:"q" default:""`

	// Sort is the field, that should be sorted by.
	// When left empty, the default sorting is used.
	Sort string `json:"sort,omitempty" query:"sort,omitempty" validate:"oneof=score added modified name"`

	// SortDescending defines the sort order.
	SortDescending bool `json:"sortDescending" query:"desc" default:"true"`

	// Fuzzy defines whether to use fuzzy or wildcard search.
	Fuzzy bool `json:"fuzzy,omitempty" query:"fuzzy" default:"false"`

	// Page is current page.
	Page uint `json:"page" query:"page" default:"0"`

	// PageSize defines the number of hits returned per page.
	//
	// PageSize is infinite when set to 0 (i.e. infinite scroll).
	PageSize int64 `json:"pageSize" query:"pageSize" default:"10" validate:"gte=0,lte=180"`

	// Categories are the categories to search in. By default,
	// a Union category is performed to search in all categories.
	Categories []target.Category `json:"categories" query:"category" validate:"unique,dive" default:"union"`
}

Options defines a set of optional search parameters.

type Service added in v0.9.16

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

func Connect

func Connect(
	conf *cfg.SearchConfig,
	log *zerolog.Logger,
	v *validator.Validate,
	searchStorage *searchdb.Storage,
) (*Service, error)

func (*Service) CreateAllIndexes added in v0.9.16

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

func (*Service) HandleSearch added in v0.9.16

func (s *Service) HandleSearch(c *fiber.Ctx) error

@Summary Perform a search for the given query and options @Description Search for media, users, posts, artists, etc. @Tags search,media,metadata,users,posts,reviews @Param X-CSRF-Token header string false "CSRF token. Required when using POST." @Param q query string false "The search query. Falls back to a wildcard query if not provided." @Param category query string false "The category to search in" Enums(union,members,artists,media,ratings,genres) @Param fuzzy query boolean false "Whether to perform a fuzzy search" @Param sort query string false "The field to sort the results by" Enums(score,added,modified,name) @Param desc query boolean false "Whether to sort the results in descending order" @Param page query integer false "The page to return" @Param pageSize query integer false "The number of results to return per page" @Accept json @Router /search [post] @Router /search [get]

func (*Service) RunQuery added in v0.9.16

func (s *Service) RunQuery(opts *Options) (res *meilisearch.SearchResponse, err error)

Jump to

Keyboard shortcuts

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