Implementation:1broseidon Ketch docs Searcher
| Knowledge Sources | |
|---|---|
| Domains | Docs_Search, Interface_Design |
| Last Updated | 2026-10-27 00:00 GMT |
Overview
The docs-search backend contract: one method that returns curated library/API documentation results, implemented by Context7 (with a hidden local FTS5 stub).
Description
The docs.Searcher interface is the third independent Searcher — docs search never shares backends with web or code search. ErrNotFound flags a permanently absent resource (e.g. a Context7 404 for a bad library ID); the surfaces map it to a not-found classification (exit 3 / `[not_found]`) rather than a retryable upstream failure. Providers may implement `docs.LibraryResolver` for library resolve/get-docs operations.
Usage
Resolved via `docs.NewFromConfig`. Use when implementing a docs backend or accepting any docs provider generically.
Code Reference
Source Location
- Repository: ketch
- File: docs/docs.go
Signature
var ErrNotFound = errors.New("not found")
type Result struct {
Library string `json:"library"`
Version string `json:"version,omitempty"`
Title string `json:"title"`
Breadcrumb string `json:"breadcrumb,omitempty"`
Snippet string `json:"snippet"`
URL string `json:"url"`
Source string `json:"source"` // "context7" | "local"
}
type Searcher interface {
Search(ctx context.Context, query string, limit int) ([]Result, error)
}
Import
import "github.com/1broseidon/ketch/docs"
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| ctx | context.Context | Yes | Bounds the search |
| query | string | Yes | Docs query |
| limit | int | Yes | Max results |
Outputs
| Name | Type | Description |
|---|---|---|
| return | []docs.Result | Documentation results |
| return error | error | ErrNotFound (mapped to not-found) or upstream failure |
Usage Examples
Docs Search
searcher, _ := docs.NewFromConfig(cfg, cfg.DocsBackend)
results, err := searcher.Search(ctx, "react hooks", 5)