docssearch

package
v0.0.1-alpha.30 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package docssearch serves search over the published docs/ tree.

The corpus searched below is index.gen.jsonl, generated from docs/ and committed — this package embeds it, so a bare checkout has to build. After editing anything under docs/, regenerate with `make docs-index` (or `task docs-index`, or `go generate` here) and commit the result; CI fails on a stale index. See index.go for how it is loaded and why it is shaped that way.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Unavailable

func Unavailable() error

Unavailable reports why the index cannot serve searches, or nil when it can. Callers serving the docs search endpoint must distinguish this from a query with no matches: an unreadable index would otherwise answer every query with an empty result set, which looks like a working search over an empty corpus. An index that parsed but holds no documents is one of the failures, not a third state — parseIndex reports it as an error.

Types

type Document

type Document struct {
	ID          int
	Path        string
	Href        string
	Title       string
	Description string
	Section     string
	Tags        []string
}

Document is the metadata returned for a searchable documentation page.

type Posting

type Posting struct {
	Doc   int
	Score int
}

Posting records a precomputed relevance score for a term in a document.

type Result

type Result struct {
	Document
	Score int
}

Result is one ranked documentation search result.

func Search(query string, limit int) []Result

Search returns ranked documentation matches from the generated index. A document matches only when it holds every token in the query; its score is the sum of the per-term scores the generator weighted by field.

Jump to

Keyboard shortcuts

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