search

package
v1.0.0-alpha.20 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDuplicateEntity = NewSearchError(http.StatusConflict, ErrCodeDuplicate, "entity already exists")
	ErrNotFound        = NewSearchError(http.StatusNotFound, ErrCodeNotFound, "not found")
)

Functions

func IsSearchError

func IsSearchError(err error) bool

func NewSearchError

func NewSearchError(httpCode int, code ErrCode, msg string, args ...interface{}) error

Types

type ErrCode

type ErrCode byte
const (
	ErrCodeInvalid           ErrCode = 0x00
	ErrCodeDuplicate         ErrCode = 0x01
	ErrCodeNotFound          ErrCode = 0x02
	ErrCodeIndexingDocuments ErrCode = 0x03
	ErrCodeUnhandled         ErrCode = 0x04
)

type Error

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

func (Error) Error

func (se Error) Error() string

type IndexDocumentsOptions

type IndexDocumentsOptions struct {
	Action    string
	BatchSize int
}

type NoopStore

type NoopStore struct{}

func (*NoopStore) CreateCollection

func (n *NoopStore) CreateCollection(_ context.Context, _ *tsApi.CollectionSchema) error

func (*NoopStore) DeleteDocuments

func (n *NoopStore) DeleteDocuments(_ context.Context, _ string, _ string) error

func (*NoopStore) DropCollection

func (n *NoopStore) DropCollection(_ context.Context, _ string) error

func (*NoopStore) IndexDocuments

func (n *NoopStore) IndexDocuments(_ context.Context, _ string, _ io.Reader, _ IndexDocumentsOptions) error

func (*NoopStore) Search

func (n *NoopStore) Search(_ context.Context, _ string, _ string, _ int, _ int) ([]tsApi.SearchResult, error)

type Store

type Store interface {
	CreateCollection(ctx context.Context, schema *tsApi.CollectionSchema) error
	DropCollection(ctx context.Context, table string) error
	IndexDocuments(ctx context.Context, table string, documents io.Reader, options IndexDocumentsOptions) error
	DeleteDocuments(ctx context.Context, table string, key string) error
	Search(ctx context.Context, table string, filterBy string, page int, perPage int) ([]tsApi.SearchResult, error)
}

func NewStore

func NewStore(config *config.SearchConfig) (Store, error)

Jump to

Keyboard shortcuts

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