codesearch

package
v0.13.4 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RepoStats

type RepoStats struct {
	Repo       string `json:"repo"`
	MatchCount int    `json:"match_count"`
	FileCount  int    `json:"file_count"`
}

RepoStats holds per-repo match statistics.

type Result

type Result struct {
	Repo          string   `json:"repo"`
	Path          string   `json:"path"`
	Line          int      `json:"line"`
	Column        int      `json:"column"`
	ContextBefore []string `json:"context_before"`
	ContextLine   string   `json:"context_line"`
	ContextAfter  []string `json:"context_after"`
	Score         float64  `json:"score"`
}

Result is a single code search match from peregrine.

type SearchRequest

type SearchRequest struct {
	Query         string
	Repos         []string
	MaxResults    int
	CaseSensitive bool
}

SearchRequest holds the parameters for a code search call to peregrine via the cell's entire-api gateway at GET /api/v1/search/api/search.

type SearchResponse

type SearchResponse struct {
	Query     string      `json:"query"`
	Stats     Stats       `json:"stats"`
	RepoStats []RepoStats `json:"repo_stats"`
	Results   []Result    `json:"results"`

	// FailedJurisdictions is set by the CLI's merge layer (not by peregrine)
	// when one or more cells failed during multi-region fan-out.
	FailedJurisdictions []string `json:"failed_jurisdictions,omitempty"`

	// SkippedRepos is set by the CLI's fan-out layer (not by peregrine) when
	// explicitly requested repos had no routable home placement (missing or
	// not ready) and were excluded from the search.
	SkippedRepos []string `json:"skipped_repos,omitempty"`
}

SearchResponse is peregrine's code search response.

func Search(ctx context.Context, client *api.Client, req SearchRequest) (*SearchResponse, error)

Search calls peregrine's code search endpoint through the cell's entire-api gateway: GET /api/v1/search/api/search?q=...&max_results=...&repo=... The client must already be authenticated against the cell.

type Stats

type Stats struct {
	TotalMatches  int     `json:"total_matches"`
	TotalFiles    int     `json:"total_files"`
	DurationMs    float64 `json:"duration_ms"`
	ReposSearched int     `json:"repos_searched"`
}

Stats holds aggregate search statistics.

Jump to

Keyboard shortcuts

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