index

package
v0.1.46 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2025 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const CurrentSchemaVersion = 5
View Source
const DefaultPageSize = 100

Variables

This section is empty.

Functions

func OpenOrCreate

func OpenOrCreate(
	dataRoot string,
	force bool,
	options *Options,
) (*ReadIndex, *WriteIndex, bool, errors.E)

Types

type BatchError

type BatchError struct {
	errors.E
}

func (*BatchError) Error

func (e *BatchError) Error() string

type DocumentMatch

type DocumentMatch struct {
	*search.DocumentMatch
	Data nix.Importable
}

type Meta

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

func (*Meta) GetSourceMeta

func (i *Meta) GetSourceMeta(source string) *SourceMeta

func (*Meta) IsSchemaOutdated

func (i *Meta) IsSchemaOutdated() bool

func (*Meta) LastUpdated

func (i *Meta) LastUpdated() time.Time

func (*Meta) Save

func (i *Meta) Save() errors.E

func (*Meta) SetSourceMeta

func (i *Meta) SetSourceMeta(source string, meta *SourceMeta)

type Options

type Options struct {
	LowMemory bool
	BatchSize int
	Logger    *log.Logger
}

type ReadIndex

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

func (*ReadIndex) Close

func (index *ReadIndex) Close() error

func (*ReadIndex) GetDocument

func (index *ReadIndex) GetDocument(
	ctx context.Context,
	source *config.Source,
	id string,
) (*nix.Importable, errors.E)

func (*ReadIndex) GetEnabledSources

func (index *ReadIndex) GetEnabledSources() ([]string, errors.E)

func (*ReadIndex) LastUpdated

func (index *ReadIndex) LastUpdated() time.Time

func (*ReadIndex) Search

func (index *ReadIndex) Search(
	ctx context.Context,
	source *config.Source,
	keyword string,
	from int,
	pageSize int,
) (*Result, errors.E)

type Result

type Result struct {
	*bleve.SearchResult
	Hits iter.Seq[DocumentMatch]
}

type SourceMeta

type SourceMeta struct {
	Updated time.Time
	Path    string
	Rev     string
}

type WriteIndex

type WriteIndex struct {
	Meta *Meta
	// contains filtered or unexported fields
}

func (*WriteIndex) Close

func (i *WriteIndex) Close() (err errors.E)

func (*WriteIndex) DeleteBySource

func (i *WriteIndex) DeleteBySource(source string) errors.E

func (*WriteIndex) Flush

func (i *WriteIndex) Flush(batch *bleve.Batch) errors.E

func (*WriteIndex) Import

func (i *WriteIndex) Import(
	ctx context.Context,
	objects <-chan nix.Importable,
) <-chan errors.E

func (*WriteIndex) SaveMeta

func (i *WriteIndex) SaveMeta() errors.E

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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