fulltext

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: Apache-2.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
}

func (*IndexElement) SetContentType

func (i *IndexElement) SetContentType(v string)

type Indexer

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

func New

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

func (*Search) BatchIndex

func (f *Search) BatchIndex(elements []IndexElement) error

func (*Search) Close

func (f *Search) Close() error

func (*Search) Delete

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

func (*Search) GetHighlights

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

func (*Search) Index

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

func (*Search) Search

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

type SearchResult

type SearchResult struct {
	Status   interface{}   `json:"status"`
	Request  *interface{}  `json:"request"`
	Hits     []interface{} `json:"hits"`
	Total    uint64        `json:"total_hits"`
	MaxScore float64       `json:"max_score"`
	Took     time.Duration `json:"took"`
	Facets   interface{}   `json:"facets"`
}

Jump to

Keyboard shortcuts

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