search

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 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

View Source
var ErrInvalidQuery = errors.New("invalid query")

Functions

This section is empty.

Types

type BackendRequest

type BackendRequest struct {
	Query            string
	RepositoryIDs    []uint32
	RepositoryScopes []RepositoryScope
	InstallationID   int64
	Limit            int
	ContextLines     int
	Timeout          time.Duration
}

type GitHubBackend

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

func NewGitHubBackend

func NewGitHubBackend(client GitHubSearchClient, chunk int) *GitHubBackend

func (*GitHubBackend) Health

func (backend *GitHubBackend) Health(context.Context) error

func (*GitHubBackend) Search

func (backend *GitHubBackend) Search(ctx context.Context, request BackendRequest) (api.SearchResponse, error)

type GitHubSearchClient

type GitHubSearchClient interface {
	SearchCode(context.Context, int64, string, []int64) (api.SearchResponse, error)
}

GitHubSearchClient is deliberately limited to installation-scoped search.

type Limits

type Limits struct {
	DefaultResults, MaxResults           int
	DefaultContextLines, MaxContextLines int
	DefaultTimeout, MaxTimeout           time.Duration
	MaxResponseBytes                     int64
}

type QueryError added in v0.12.0

type QueryError struct {
	Reason string
	// Query is the caller's query; it is used only to phrase hints.
	Query string
}

QueryError is a query that GraphNest or the search backend refused, with a reason that is safe to show the caller.

func NewQueryError added in v0.12.0

func NewQueryError(reason string) *QueryError

NewQueryError drops control characters from reason and bounds it, so a backend message echoing a hostile query stays printable and short.

func (*QueryError) Error added in v0.12.0

func (err *QueryError) Error() string

func (*QueryError) Message added in v0.12.0

func (err *QueryError) Message() string

Message is the caller-facing text, with a hint when the reason matches a known query-syntax gotcha.

func (*QueryError) Unwrap added in v0.12.0

func (err *QueryError) Unwrap() error

type RepositoryScope

type RepositoryScope struct {
	ID, GitHubID, InstallationID int64
	Name                         string
	IndexedSHA                   string
}

RepositoryScope is the backend-neutral, authorization-derived repository identity. Backends must never discover repositories independently.

type SearchBackend

type SearchBackend interface {
	Search(context.Context, BackendRequest) (api.SearchResponse, error)
	Health(context.Context) error
}

type Service

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

func NewService

func NewService(backend SearchBackend, authorizer authz.Authorizer, limits Limits) *Service

func (*Service) Search

func (service *Service) Search(ctx context.Context, principal authn.Principal, request api.SearchRequest) (api.SearchResponse, error)

Jump to

Keyboard shortcuts

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