index

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDuplicateDocument   = errors.New("Cannot index duplicate document")
	ErrNonExistentDocument = errors.New("Document does not exist")
)

Functions

func Export

func Export(index *Index, path string) error

Types

type Gobber

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

func (*Gobber) GobDecode

func (g *Gobber) GobDecode(buf []byte) error

func (*Gobber) GobEncode

func (g *Gobber) GobEncode() ([]byte, error)

type Index

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

func Import

func Import(path string) (*Index, error)

func LoadDocuments

func LoadDocuments(dir string, indexOpts Opts) (*Index, error)

func New

func New(opts Opts) *Index

func (*Index) AddDocument

func (i *Index) AddDocument(document core.Document) error

func (*Index) DeleteDocument

func (i *Index) DeleteDocument(id core.DocumentID) error

func (*Index) GetAnalyzer

func (i *Index) GetAnalyzer() analysis.Analyzer

func (*Index) GetDocument

func (i *Index) GetDocument(id core.DocumentID) core.Document

func (*Index) GetSpellSuggestions

func (i *Index) GetSpellSuggestions(terms []string, top int) (suggestions map[string][]string)

func (*Index) GetTermFrequencies

func (i *Index) GetTermFrequencies(id core.DocumentID) core.TermFrequency

func (*Index) Length

func (i *Index) Length() int

func (*Index) SearchDocuments

func (i *Index) SearchDocuments(query string, filterFn search.Filter, rankFn search.Ranker) (documentScores []core.DocumentScore)

func (*Index) UpdateDocument

func (i *Index) UpdateDocument(document core.Document) error

func (*Index) UpsertDocument

func (i *Index) UpsertDocument(document core.Document) error

type Opts

type Opts struct {
	Analyzer            analysis.Analyzer
	FuzzyMinOccurrences int
	FuzzyDepth          int
}

Jump to

Keyboard shortcuts

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