Help us shape the future of Go! Take the 2026 Go Developer Survey

search

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package search provides full-text search across specification files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SearchOptions

type SearchOptions struct {
	Limit         int      // Maximum results to return (default 20)
	Projects      []string // Filter by project names (empty = all)
	SpecTypes     []string // Filter by spec types (mrd, prd, trd, etc.)
	CaseSensitive bool     // Case sensitive matching
	Regex         bool     // Treat query as regex
	ContextLines  int      // Lines of context around match (default 1)
}

SearchOptions configures search behavior.

func DefaultSearchOptions

func DefaultSearchOptions() SearchOptions

DefaultSearchOptions returns sensible defaults.

type SearchOutput

type SearchOutput struct {
	Query      string          `json:"query"`
	TotalHits  int             `json:"total_hits"`
	Results    []*SearchResult `json:"results"`
	Took       string          `json:"took"`
	ByProject  map[string]int  `json:"by_project,omitempty"`
	BySpecType map[string]int  `json:"by_spec_type,omitempty"`
	Truncated  bool            `json:"truncated,omitempty"`
}

SearchOutput contains the full search response.

type SearchResult

type SearchResult struct {
	Project    string  `json:"project"`
	SpecType   string  `json:"spec_type"`
	FilePath   string  `json:"file_path"`
	Line       int     `json:"line"`
	Score      float64 `json:"score"`
	Snippet    string  `json:"snippet"`
	Context    string  `json:"context,omitempty"`
	MatchCount int     `json:"match_count"`
}

SearchResult represents a single search hit.

type Searcher

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

Searcher provides full-text search over spec files.

func NewSearcher

func NewSearcher(specsDir string) *Searcher

NewSearcher creates a new searcher for a specs directory.

func (*Searcher) Search

func (s *Searcher) Search(query string, opts SearchOptions) (*SearchOutput, error)

Search performs a full-text search across specs.

Jump to

Keyboard shortcuts

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