fulltext

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: AGPL-3.0 Imports: 28 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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