Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:1broseidon Ketch docs Searcher

From Leeroopedia
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)

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment