search

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package search provides search functionality via the Entire search service.

Index

Constants

View Source
const AllReposFilter = "*"

AllReposFilter is the inline repo filter value that disables repo scoping.

View Source
const DefaultServiceURL = "https://entire.io"

DefaultServiceURL is the production search service URL.

View Source
const MaxLimit = 200

MaxLimit is the maximum number of results the search API will return per request.

View Source
const WildcardQuery = "*"

WildcardQuery is the query string used when only filters are provided (no search terms).

Variables

This section is empty.

Functions

func ParseGitHubRemote

func ParseGitHubRemote(remoteURL string) (owner, repo string, err error)

ParseGitHubRemote extracts owner and repo from a GitHub remote URL. Supports SCP-style SSH (git@github.com:owner/repo.git), ssh:// URLs (ssh://git@github.com/owner/repo.git), and HTTPS (https://github.com/owner/repo.git).

func ValidateRepoFilters

func ValidateRepoFilters(repos []string) error

ValidateRepoFilters ensures repo filters match backend semantics.

Types

type CheckpointResult

type CheckpointResult struct {
	ID             string   `json:"id"`
	Prompt         string   `json:"prompt"`
	CommitMessage  *string  `json:"commitMessage"`
	CommitSHA      *string  `json:"commitSha"`
	Branch         string   `json:"branch"`
	Org            string   `json:"org"`
	Repo           string   `json:"repo"`
	Author         string   `json:"author"`
	AuthorUsername *string  `json:"authorUsername"`
	CreatedAt      string   `json:"createdAt"`
	FilesTouched   []string `json:"filesTouched"`
}

CheckpointResult represents a checkpoint returned by the search service.

type Config

type Config struct {
	ServiceURL  string // Base URL of the search service
	GitHubToken string
	Owner       string
	Repo        string
	Repos       []string
	Query       string
	Limit       int
	Author      string // Filter by author name
	Date        string // Filter by time period: "week" or "month"
	Branch      string // Filter by branch name
	Page        int    // 1-based page number (0 means omit, API defaults to 1)
}

Config holds the configuration for a search request.

func (Config) HasFilters

func (c Config) HasFilters() bool

HasFilters reports whether any filter fields are set on the config.

type Meta

type Meta struct {
	MatchType string  `json:"matchType"`
	Score     float64 `json:"score"`
	Snippet   string  `json:"snippet,omitempty"`
}

Meta contains search ranking metadata for a result.

type ParsedInput

type ParsedInput struct {
	Query  string
	Author string
	Date   string
	Branch string
	Repos  []string
}

ParsedInput holds the parsed query and optional filters extracted from search input.

func ParseSearchInput

func ParseSearchInput(raw string) ParsedInput

ParseSearchInput extracts filter prefixes from raw input. Supports quoted values for single-value filters, for example: author:"alice smith". Remaining tokens become the query.

type Response

type Response struct {
	Results []Result `json:"results"`
	Total   int      `json:"total"`
	Page    int      `json:"page"`
	Error   string   `json:"error,omitempty"`
}

Response is the search service response.

func Search(ctx context.Context, cfg Config) (*Response, error)

Search calls the search service to perform a hybrid search.

type Result

type Result struct {
	Type string           `json:"type"`
	Data CheckpointResult `json:"data"`
	Meta Meta             `json:"searchMeta"`
}

Result wraps a search result with its type and ranking metadata.

Jump to

Keyboard shortcuts

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