idx

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: Apache-2.0 Imports: 5 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FieldQuery added in v0.9.1

func FieldQuery(q Query) (field []byte, ok bool)

FieldQuery returns a bool indicating whether the Query is a FieldQuery, and the backing bytes of the Field.

func Marshal

func Marshal(q Query) ([]byte, error)

Marshal encodes the query into a byte slice.

Types

type Index

type Index interface {
	// Insert inserts a document into the index.
	Insert(d doc.Metadata) error

	// Searcher returns a Searcher over a point-in-time view of the index.
	Searcher() (Searcher, error)

	// Close closes the index.
	Close() error
}

Index is an inverted index.

type Query

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

Query encapsulates a search query for an index.

func MustCreateRegexpQuery

func MustCreateRegexpQuery(field, regexp []byte) Query

MustCreateRegexpQuery is like NewRegexpQuery but panics if the query cannot be created.

func NewAllQuery added in v0.7.3

func NewAllQuery() Query

NewAllQuery returns a new query for matching all documents.

func NewConjunctionQuery

func NewConjunctionQuery(queries ...Query) Query

NewConjunctionQuery returns a new query for finding documents which match each of the given queries.

func NewDisjunctionQuery

func NewDisjunctionQuery(queries ...Query) Query

NewDisjunctionQuery returns a new query for finding documents which match at least one of the given queries.

func NewFieldQuery added in v0.8.1

func NewFieldQuery(field []byte) Query

NewFieldQuery returns a new query for finding documents which match a field exactly.

func NewNegationQuery

func NewNegationQuery(q Query) Query

NewNegationQuery returns a new query for finding documents which don't match a given query.

func NewQueryFromSearchQuery added in v0.7.1

func NewQueryFromSearchQuery(q search.Query) Query

NewQueryFromSearchQuery creates a new Query from a search.Query.

func NewRegexpQuery

func NewRegexpQuery(field, regexp []byte) (Query, error)

NewRegexpQuery returns a new query for finding documents which match a regular expression.

func NewTermQuery

func NewTermQuery(field, term []byte) Query

NewTermQuery returns a new query for finding documents which match a term exactly.

func Unmarshal

func Unmarshal(data []byte) (Query, error)

Unmarshal decodes a query from a byte slice.

func (Query) Equal

func (q Query) Equal(o Query) bool

Equal reports whether q is equal to o.

func (Query) SearchQuery

func (q Query) SearchQuery() search.Query

SearchQuery returns the underlying search query for use during execution.

func (Query) String

func (q Query) String() string

type QueryMatcher

type QueryMatcher interface {
	gomock.Matcher
}

QueryMatcher is a gomock.Matcher that matches idx.Query

func NewQueryMatcher

func NewQueryMatcher(q Query) QueryMatcher

NewQueryMatcher returns a new QueryMatcher

type Searcher

type Searcher interface {
	Search(q Query) (doc.MetadataIterator, error)

	Close() error
}

Searcher provides search over a point-in-time view of an index.

Jump to

Keyboard shortcuts

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