memory

package
v0.3.13 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package memory provides MemoryIndex, the zero-dependency in-process retrieval.Index implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

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

Index is an in-process retrieval.Index with BM25 (textsearch) + cosine vector scoring.

func New

func New() *Index

New returns an empty in-memory Index using CJKTokenizer for BM25.

func (*Index) Capabilities

func (m *Index) Capabilities() retrieval.Capabilities

Capabilities implements retrieval.Index.

func (*Index) Close

func (m *Index) Close() error

Close implements retrieval.Index.

func (*Index) Delete

func (m *Index) Delete(_ context.Context, namespace string, ids []string) error

Delete implements retrieval.Index.

func (*Index) DeleteByFilter

func (m *Index) DeleteByFilter(_ context.Context, namespace string, f retrieval.Filter) (int64, error)

DeleteByFilter implements retrieval.DeletableByFilter.

func (*Index) Drop

func (m *Index) Drop(_ context.Context, namespace string) error

Drop implements retrieval.Droppable.

func (*Index) Get

func (m *Index) Get(_ context.Context, namespace, id string) (retrieval.Doc, bool, error)

Get implements retrieval.DocGetter.

func (*Index) Iterate

func (m *Index) Iterate(_ context.Context, namespace string, cursor string, batch int) ([]retrieval.Doc, string, error)

Iterate implements retrieval.Iterable.

func (*Index) List

func (m *Index) List(_ context.Context, namespace string, req retrieval.ListRequest) (*retrieval.ListResponse, error)

List implements retrieval.Index.

func (*Index) Search

func (m *Index) Search(_ context.Context, namespace string, req retrieval.SearchRequest) (*retrieval.SearchResponse, error)

Search implements retrieval.Index.

func (*Index) Upsert

func (m *Index) Upsert(_ context.Context, namespace string, docs []retrieval.Doc) error

Upsert implements retrieval.Index.

Jump to

Keyboard shortcuts

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