search

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package search provides full-text search over the neuron vault using an in-memory inverted index with BM25-like relevance scoring.

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 a thread-safe in-memory inverted index.

func NewIndex

func NewIndex() *Index

NewIndex creates an empty Index.

func (*Index) IndexNote

func (idx *Index) IndexNote(note *notes.Note)

IndexNote adds or updates a single note in the index.

func (*Index) Rebuild

func (idx *Index) Rebuild(noteList []*notes.Note)

Rebuild replaces the entire index with the given note list.

func (*Index) RemoveNote

func (idx *Index) RemoveNote(noteID string)

RemoveNote removes a note from the index by ID.

func (*Index) Search

func (idx *Index) Search(query string, limit int) []*SearchResult

Search performs a BM25-inspired ranked search and returns up to limit results. A limit of 0 returns all matching results.

type SearchResult

type SearchResult struct {
	Note  *notes.Note
	Score float64
}

SearchResult pairs a note with its relevance score.

type SemanticIndex

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

SemanticIndex provides vector-based semantic search over notes using local embeddings.

func NewSemanticIndex

func NewSemanticIndex(cfg *config.Config) (*SemanticIndex, error)

NewSemanticIndex initializes a new semantic index using the provided AI configuration.

func (*SemanticIndex) Rebuild

func (idx *SemanticIndex) Rebuild(ctx context.Context, noteList []*notes.Note) error

Rebuild clears and rebuilds the entire semantic index. This may take time if there are many notes and embeddings must be generated.

func (*SemanticIndex) Search

func (idx *SemanticIndex) Search(ctx context.Context, query string, limit int) ([]*SearchResult, error)

Search queries the semantic index and returns the top results.

Jump to

Keyboard shortcuts

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