memory

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: Apache-2.0 Imports: 11 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 NameSpaceStore added in v0.3.0

type NameSpaceStore struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

NameSpaceStore is the default namespace.Store for namespace.Service.

Note: mutations in this store are ephemeral.

func NewNameSpaceStore added in v0.3.0

func NewNameSpaceStore() *NameSpaceStore

NewNameSpaceStore creates an in-memory namespace.Store.

func (*NameSpaceStore) Delete added in v0.3.0

func (ms *NameSpaceStore) Delete(id string) error

Delete removes a NameSpace from the store.

When the Namespace is not found it returns an domain.ErrNameSpaceNotFound error.

func (*NameSpaceStore) Get added in v0.3.0

func (ms *NameSpaceStore) Get(id string) (*domain.Namespace, error)

func (*NameSpaceStore) GetWithBase added in v0.3.0

func (ms *NameSpaceStore) GetWithBase(base string) (*domain.Namespace, error)

GetWithBase returns a NameSpace from the store if the base URI is found.

func (*NameSpaceStore) GetWithPrefix added in v0.3.0

func (ms *NameSpaceStore) GetWithPrefix(prefix string) (*domain.Namespace, error)

GetWithPrefix returns a NameSpace from the store if the prefix is found.

func (*NameSpaceStore) Len added in v0.3.0

func (ms *NameSpaceStore) Len() int

Len returns the number of stored namespaces. Alternatives Base or Prefixes don't count towards the total.

func (*NameSpaceStore) List added in v0.3.0

func (ms *NameSpaceStore) List() ([]*domain.Namespace, error)

List returns a list of all the stored NameSpace objects. An error is only returned when the underlying datastructure is unavailable.

func (*NameSpaceStore) Put added in v0.3.0

func (ms *NameSpaceStore) Put(ns *domain.Namespace) error

Put stores the NameSpace in the Store

type OrganizationStore added in v0.3.0

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

func NewOrganizationStore added in v0.3.0

func NewOrganizationStore() *OrganizationStore

func (*OrganizationStore) Delete added in v0.3.0

func (*OrganizationStore) Filter added in v0.3.0

Filter returns a subset of the available domains. When the filter returns no result domain.ErrOrgNotFound is returned.

func (*OrganizationStore) Get added in v0.3.0

func (*OrganizationStore) Put added in v0.3.0

func (*OrganizationStore) Shutdown added in v0.3.0

func (ms *OrganizationStore) Shutdown(ctx context.Context) error

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