core

package
v0.0.0-...-7f52054 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package core coordinates the user-visible indexing and search workflows.

The package deliberately keeps orchestration separate from storage, embedding, and file discovery. That split keeps the important product rules visible here: a full project index may prune any missing indexed file, but a path-specific index may only prune files inside the requested path scope.

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyIndex = errors.New("index is empty; run `mdidx index` first")

ErrEmptyIndex lets the CLI return the same configuration-style exit code for a project that has a config file but has not built a usable index yet.

Functions

func Search(ctx context.Context, project config.Project, query string, opts SearchOptions) ([]store.SearchResult, error)

func Stats

func Stats(ctx context.Context, project config.Project) (store.Stats, error)

Types

type IndexSummary

type IndexSummary struct {
	Scanned int `json:"scanned"`
	Changed int `json:"changed"`
	Deleted int `json:"deleted"`
	Chunks  int `json:"chunks"`
}

IndexSummary is part of the CLI JSON contract; keep field names stable for agents and scripts that consume `mdidx index --json`.

func Index

func Index(ctx context.Context, project config.Project, paths []string, opts Options) (IndexSummary, error)

type Options

type Options struct {
	APIKey   string
	Progress ProgressFunc
}

type ProgressEvent

type ProgressEvent struct {
	Stage          string `json:"stage"`
	Message        string `json:"message"`
	ScannedFiles   int    `json:"scanned_files,omitempty"`
	ChangedFiles   int    `json:"changed_files,omitempty"`
	DeletedFiles   int    `json:"deleted_files,omitempty"`
	File           string `json:"file,omitempty"`
	Batch          int    `json:"batch,omitempty"`
	TotalBatches   int    `json:"total_batches,omitempty"`
	EmbeddedChunks int    `json:"embedded_chunks,omitempty"`
	TotalChunks    int    `json:"total_chunks,omitempty"`
}

ProgressEvent is deliberately coarse-grained. It lets the CLI report useful long-run status without coupling terminal output to storage or embedding internals, and without changing the stable IndexSummary JSON shape.

type ProgressFunc

type ProgressFunc func(ProgressEvent)

type SearchOptions

type SearchOptions struct {
	Limit          int
	APIKey         string
	LexicalWeight  float64
	VectorWeight   float64
	CandidateLimit int
	Path           string
}

Jump to

Keyboard shortcuts

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