presearchers

package
v0.0.0-...-dd08211 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorEmptyID     = errors.New("document ID cannot be empty")
	ErrorIndexClosed = errors.New("index is closed")
)

Functions

This section is empty.

Types

type Index

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

Index is a stripped down version on bleve.Index

func NewIndex

func NewIndex(mapping mapping.IndexMapping) (*Index, error)

NewIndex creates a memory-only index.

func (*Index) Close

func (i *Index) Close() error

Close closes the index.

func (*Index) Delete

func (i *Index) Delete(id string) (err error)

Delete entries for the specified identifier from the index.

func (*Index) DocCount

func (i *Index) DocCount() (count uint64, err error)

DocCount returns the number of documents in the index.

func (*Index) Index

func (i *Index) Index(doc *document.Document) (err error)

Index indexes a document.Document.

func (*Index) Search

func (i *Index) Search(qry query.Query, col search.Collector) (sr *bleve.SearchResult, err error)

Search executes a search request operation.

func (*Index) SearchInContext

func (i *Index) SearchInContext(
	ctx context.Context,
	qry query.Query,
	collector search.Collector,
) (sr *bleve.SearchResult, err error)

SearchInContext executes a search request operation within the provided Context.

type Presearcher

type Presearcher interface {
	// BuildQuery builds a query.Query from a document.
	BuildQuery(doc map[string]interface{}) query.Query

	// IndexQuery creates a document.Document from a query.Query.
	IndexQuery(id string, query query.Query) *document.Document
}

type TermPresearcher

type TermPresearcher struct {
}

func (*TermPresearcher) BuildQuery

func (p *TermPresearcher) BuildQuery(doc map[string]interface{}) query.Query

BuildQuery builds a query.Query from a document.

func (*TermPresearcher) IndexQuery

func (p *TermPresearcher) IndexQuery(id string, query query.Query) *document.Document

IndexQuery creates a document.Document from a query.Query.

Jump to

Keyboard shortcuts

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