dao

package
v4.4.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Overview

Package dao abstract the indexation engine and provides a bleve-based implementation.

Package bleve implements the search engine using a Bleve indexer.

Index

Constants

This section is empty.

Variables

View Source
var (
	BatchSize = 2000
)

Functions

func NewDAO

func NewDAO(ctx context.Context, o dao.DAO) (dao.DAO, error)

func NewQueryCodec

func NewQueryCodec(indexDAO dao.IndexDAO, values configx.Values, metaProvider *meta.NsProvider) dao.IndexCodex

Types

type Batch

type Batch struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Batch avoids overflowing bleve index by batching indexation events (index/delete)

func NewBatch

func NewBatch(ctx context.Context, nsProvider *meta.NsProvider, options BatchOptions) *Batch

func (*Batch) Delete

func (b *Batch) Delete(uuid string)

func (*Batch) Flush

func (b *Batch) Flush(indexer dao.IndexDAO) error

func (*Batch) Index

func (b *Batch) Index(i *tree.IndexableNode)

func (*Batch) LoadIndexableNode

func (b *Batch) LoadIndexableNode(indexNode *tree.IndexableNode, excludes map[string]struct{}) error

func (*Batch) Size

func (b *Batch) Size() int

type BatchOptions

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

type SearchEngine

type SearchEngine interface {
	IndexNode(context.Context, *tree.Node, bool, map[string]struct{}) error
	DeleteNode(context.Context, *tree.Node) error
	SearchNodes(context.Context, *tree.Query, int32, int32, string, bool, chan *tree.Node, chan *tree.SearchFacet, chan bool) error
	ClearIndex(ctx context.Context) error
	Close() error
}

type Server

type Server struct {
	Ctx    context.Context
	Router nodes.Handler
	Engine dao.IndexDAO
	// contains filtered or unexported fields
}

func NewEngine

func NewEngine(ctx context.Context, indexer dao.IndexDAO, nsProvider *meta.NsProvider, configs configx.Values) (*Server, error)

func (*Server) ClearIndex

func (s *Server) ClearIndex(ctx context.Context) error

func (*Server) Close

func (s *Server) Close() error

func (*Server) DeleteNode

func (s *Server) DeleteNode(c context.Context, n *tree.Node) error

func (*Server) IndexNode

func (s *Server) IndexNode(c context.Context, n *tree.Node, reloadCore bool, excludes map[string]struct{}) error

func (*Server) SearchNodes

func (s *Server) SearchNodes(c context.Context, queryObject *tree.Query, from int32, size int32, sortField string, sortDesc bool, resultChan chan *tree.Node, facets chan *tree.SearchFacet, doneChan chan bool) error

Directories

Path Synopsis
Package stub is a helper for testing indexation
Package stub is a helper for testing indexation

Jump to

Keyboard shortcuts

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