fulltext

package
v0.0.0-...-7cc7ebb Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: AGPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IndexElement

type IndexElement struct {
	EventID        string
	RoomID         string
	Content        string
	ContentType    string
	StreamPosition int64
}

IndexElement describes the layout of an element to index

func (*IndexElement) SetContentType

func (i *IndexElement) SetContentType(v string)

SetContentType sets i.ContentType given an identifier

type Indexer

type Indexer interface {
	Index(elements ...IndexElement) error
	Delete(eventID string) error
	Search(term string, roomIDs, keys []string, limit, from int, orderByStreamPos bool) (*bleve.SearchResult, error)
	GetHighlights(result *bleve.SearchResult) []string
	Close() error
}
type Search struct {
	FulltextIndex bleve.Index
}

Search contains all existing bleve.Index

func New

func New(processCtx *process.ProcessContext, cfg config.Fulltext) (fts *Search, err error)

New opens a new/existing fulltext index

func (*Search) Close

func (f *Search) Close() error

Close closes the fulltext index

func (*Search) Delete

func (f *Search) Delete(eventID string) error

Delete deletes an indexed element by the eventID

func (*Search) GetHighlights

func (f *Search) GetHighlights(result *bleve.SearchResult) []string

GetHighlights extracts the highlights from a SearchResult.

func (*Search) Index

func (f *Search) Index(elements ...IndexElement) error

Index indexes the given elements

func (*Search) Search

func (f *Search) Search(term string, roomIDs, keys []string, limit, from int, orderByStreamPos bool) (*bleve.SearchResult, error)

Search searches the index given a search term, roomIDs and keys.

Jump to

Keyboard shortcuts

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