search

package
v0.0.0-...-883aa5b Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Include

func Include(rank int) bool

func Match

func Match(q, val string) int

Match returns the rank of a match between q and val. 0 means best match. -1 means no match.

func Register

func Register(searchType SearchType, search func(ctx context.Context, q string) []*Result)

Types

type Result

type Result struct {
	Node SearchNode
	Rank int
}

type SearchFilter

type SearchFilter struct {
	Query string      `json:"query"`
	Type  *SearchType `json:"type,omitempty"`
}

type SearchNode

type SearchNode interface {
	IsSearchNode()
}

type SearchNodeConnection

type SearchNodeConnection = pagination.Connection[SearchNode]

type SearchNodeEdge

type SearchNodeEdge = pagination.Edge[SearchNode]

type SearchType

type SearchType string

func (SearchType) MarshalGQL

func (e SearchType) MarshalGQL(w io.Writer)

func (SearchType) String

func (e SearchType) String() string

func (*SearchType) UnmarshalGQL

func (e *SearchType) UnmarshalGQL(v interface{}) error

type Searchers

type Searchers struct {
	Search func(ctx context.Context, q string) []*Result
	Type   SearchType
}

Jump to

Keyboard shortcuts

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