search

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package search provides ripgrep-based full-text search across markdown files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LineSnippet

type LineSnippet struct {
	Text string `json:"text"`
	Line int    `json:"line"`
}

LineSnippet captures contextual lines around a match.

type Options

type Options struct {
	IncludeGlobs  []string
	ExcludeGlobs  []string
	Context       int
	CaseSensitive bool
	SearchHidden  bool
}

Options controls the behavior of the ripgrep search.

type Result

type Result struct {
	Path     string        `json:"path"`
	Match    string        `json:"match"`
	LineText string        `json:"lineText"`
	Before   []LineSnippet `json:"before,omitempty"`
	After    []LineSnippet `json:"after,omitempty"`
	Line     int           `json:"line"`
	Column   int           `json:"column"`
}

Result represents a single match from ripgrep.

type Service

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

Service executes ripgrep searches rooted at the repository.

func NewService

func NewService(root string, logger *slog.Logger) (*Service, error)

NewService constructs a ripgrep-backed search service.

func (*Service) Search

func (s *Service) Search(ctx context.Context, query string, opts Options) ([]Result, error)

Search executes ripgrep with the provided query and options.

Jump to

Keyboard shortcuts

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