memory

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSearchNoMatch = errors.New("the search query does not match the index")
)

Functions

This section is empty.

Types

type TextIndex

type TextIndex struct {
	Terms map[string]*search.Vectors

	DocCount int
	Docs     map[int]bool
	// contains filtered or unexported fields
}

TestIndex is a single document full-text index. This means that all data you append to it will have its position incremented and appends to the known state. It is not replaced. To reset the index to an empty state you have to call the reset method.

func DecodeTextIndex added in v0.1.3

func DecodeTextIndex(r io.Reader) (*TextIndex, error)

func NewTextIndex

func NewTextIndex() *TextIndex

func (*TextIndex) AppendBytes

func (ti *TextIndex) AppendBytes(b []byte, docID ...int) error

AppendBytes extract words from bytes and updates the TextIndex.

func (*TextIndex) AppendString

func (ti *TextIndex) AppendString(text string, docID ...int) error

AppendString extract words from bytes and updates the TextIndex.

func (*TextIndex) Encode added in v0.1.3

func (ti *TextIndex) Encode(w io.Writer) error

func (*TextIndex) Search

func (ti *TextIndex) Search(query *search.QueryTerm) (*search.Matches, error)

type TextQuery

type TextQuery struct {
	Hits         *search.Matches
	EmStartTag   string
	EmStyleClass string
	// contains filtered or unexported fields
}

func NewTextQuery

func NewTextQuery(q *search.QueryTerm) *TextQuery

func NewTextQueryFromString

func NewTextQueryFromString(query string) (*TextQuery, error)

func (*TextQuery) AppendString added in v0.1.3

func (tq *TextQuery) AppendString(text string, docID int) error

func (*TextQuery) Highlight

func (tq *TextQuery) Highlight(text string, docID int) (string, bool)

func (*TextQuery) PerformSearch added in v0.1.3

func (tq *TextQuery) PerformSearch() (bool, error)

func (*TextQuery) Reset added in v0.1.3

func (tq *TextQuery) Reset()

func (*TextQuery) SetTextIndex added in v0.1.3

func (tq *TextQuery) SetTextIndex(ti *TextIndex)

Jump to

Keyboard shortcuts

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