engine

package
v1.1.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2025 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildBleveMapping

func BuildBleveMapping() (mapping.IndexMapping, error)

BuildBleveMapping builds a bleve index mapping which can be used for indexing

func NewBleveIndex

func NewBleveIndex(root string) (bleve.Index, error)

NewBleveIndex returns a new bleve index given path must exist.

Types

type Bleve

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

Bleve represents a search engine which utilizes bleve to search and store resources.

func NewBleveEngine

func NewBleveEngine(index bleve.Index, queryCreator searchQuery.Creator[query.Query]) *Bleve

NewBleveEngine creates a new Bleve instance

func (*Bleve) Delete

func (b *Bleve) Delete(id string) error

Delete marks the resource as deleted. The resource object will stay in the bleve index, instead of removing the resource it just marks it as deleted! can be undone

func (*Bleve) DocCount

func (b *Bleve) DocCount() (uint64, error)

DocCount returns the number of resources in the index.

func (*Bleve) Move

func (b *Bleve) Move(id string, parentid string, target string) error

Move updates the resource location and all of its necessary fields.

func (*Bleve) Purge

func (b *Bleve) Purge(id string) error

Purge removes a resource from the index, irreversible operation.

func (*Bleve) Restore

func (b *Bleve) Restore(id string) error

Restore is the counterpart to Delete. It restores the resource which makes it available again.

func (*Bleve) Search

Search executes a search request operation within the index. Returns a SearchIndexResponse object or an error.

func (*Bleve) Upsert

func (b *Bleve) Upsert(id string, r Resource) error

Upsert indexes or stores Resource data fields.

type Engine

type Engine interface {
	Search(ctx context.Context, req *searchService.SearchIndexRequest) (*searchService.SearchIndexResponse, error)
	Upsert(id string, r Resource) error
	Move(id string, parentid string, target string) error
	Delete(id string) error
	Restore(id string) error
	Purge(id string) error
	DocCount() (uint64, error)
}

Engine is the interface to the search engine

type Resource

type Resource struct {
	content.Document

	ID       string
	RootID   string
	Path     string
	ParentID string
	Type     uint64
	Deleted  bool
	Hidden   bool
}

Resource is the entity that is stored in the index.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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