Documentation
¶
Overview ¶
Package indexer coordinates file walking, embedding, querying with deduplication and optional reranking for embedding-based search.
Index ¶
- func BuildGitignore(configPatterns string) *gitignore.GitIgnore
- type Indexer
- func (idx *Indexer) Index(ctx context.Context) (*embedder.Stats, error)
- func (idx *Indexer) Progress(phase string)
- func (idx *Indexer) Query(ctx context.Context, query string, k, rerankMultiplier int) (Results, Results, error)
- func (idx *Indexer) Rerank(ctx context.Context, query string, results Results) (Results, error)
- func (idx *Indexer) SetOffload(embed, rerank bool)
- func (idx *Indexer) UseReranker(provider providers.Provider, model string)
- func (idx *Indexer) Walk(dir string) error
- type Result
- type Results
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildGitignore ¶
BuildGitignore combines .gitignore from the filesystem with config-defined patterns.
Types ¶
type Indexer ¶
type Indexer struct {
// OnProgress is called at each phase transition with a human-readable status message.
// If nil, progress is silently ignored.
OnProgress func(phase string)
// contains filtered or unexported fields
}
Indexer manages file walking, embedding, querying, and reranking.
func New ¶
func New( provider providers.Provider, embedModel, dbDir string, chunkCfg chunker.Config, gi *gitignore.GitIgnore, ) (*Indexer, error)
New creates an Indexer with the given provider, model, storage directory, and gitignore.
func (*Indexer) Query ¶
func (idx *Indexer) Query(ctx context.Context, query string, k, rerankMultiplier int) (Results, Results, error)
Query searches the index and returns both unsorted and reranked results. When no reranker is set, both return values are identical.
func (*Indexer) SetOffload ¶
SetOffload enables explicit model load/unload for embedding and/or reranking. When enabled, models are loaded before use and unloaded after to free VRAM.
func (*Indexer) UseReranker ¶
UseReranker sets the provider and model to use for reranking.
type Result ¶
type Result struct {
Path string `json:"path"`
Content string `json:"content,omitempty"`
StartLine int `json:"start_line"`
EndLine int `json:"end_line"`
Similarity float32 `json:"similarity"`
}
Result represents a single search result with file location and similarity score.