config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package config defines indexer configuration: repo root discovery, index storage paths, default field boosts, and ignore-file location.

Index

Constants

View Source
const (
	IndexDirName = ".codesearch"
	IndexSubdir  = "index"
	MetaFileName = "meta.json"
)

Index storage layout, relative to the repo root.

View Source
const DefaultMaxFileSize int64 = 1 * 1024 * 1024 // 1 MiB

DefaultMaxFileSize caps the per-file size accepted by the walker.

Variables

View Source
var DefaultBoosts = map[string]float64{
	"title":       5.0,
	"tags":        2.0,
	"body":        1.0,
	"description": 3.0,
	"keywords":    4.0,
}

DefaultBoosts are the query-time field boosts applied when an indexed field is present. SEO-base names (description, keywords) are listed here because they're the conventions used in this repo, but they're only applied when present so the indexer remains generic.

Functions

func FindRoot

func FindRoot(start string) (string, error)

FindRoot walks up from start looking for a `.git` entry (directory for a regular clone, file for a worktree). Returns the absolute path of the containing directory.

Types

type IndexConfig

type IndexConfig struct {
	Root        string
	MaxFileSize int64
	Boosts      map[string]float64
}

IndexConfig captures the runtime knobs shared across the codesearch subcommands.

func Load

func Load(start string) (*IndexConfig, error)

Load discovers the repo root from start (or cwd when empty) and returns the config with defaults applied.

func (*IndexConfig) IndexDir

func (c *IndexConfig) IndexDir() string

IndexDir is the directory where the Bleve index and metadata live.

func (*IndexConfig) IndexPath

func (c *IndexConfig) IndexPath() string

IndexPath is the Bleve index location inside IndexDir.

func (*IndexConfig) MetaPath

func (c *IndexConfig) MetaPath() string

MetaPath is the JSON sidecar location inside IndexDir.

Jump to

Keyboard shortcuts

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