docsearch

package
v0.268.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 15 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

Overview

Package docsearch is a client for the openfga.dev documentation: the Mintlify MCP search endpoint and the markdown rendering of each docs page.

Index

Constants

View Source
const DefaultBaseURL = "https://openfga.dev"

DefaultBaseURL is the docs site the client talks to.

Variables

This section is empty.

Functions

func PageURL

func PageURL(ref string) (string, error)

PageURL canonicalizes ref to https://openfga.dev/docs/<path>. It accepts a bare docs path, a /docs/ path, or a full openfga.dev URL, and drops any .md suffix, fragment and query.

Types

type Client

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

Client searches and fetches the OpenFGA docs.

func New

func New(timeout time.Duration) *Client

New returns a Client for openfga.dev. A zero timeout disables the deadline, as --timeout 0 promises.

func NewWithBaseURL

func NewWithBaseURL(base string, hc *http.Client) *Client

NewWithBaseURL returns a Client for a different base URL. It exists so other packages' tests can point a Client at an httptest server; production code uses New.

func (*Client) Page

func (c *Client) Page(ctx context.Context, ref string) (Page, error)

Page fetches the markdown rendering of a docs page, verbatim.

func (*Client) Search

func (c *Client) Search(ctx context.Context, query string) ([]Result, error)

Search runs the docs search tool and returns its hits.

type Page

type Page struct {
	URL      string `json:"url" yaml:"url"`
	Markdown string `json:"markdown" yaml:"markdown"`
}

Page is a docs page rendered as markdown.

type Result

type Result struct {
	Title       string `json:"title" yaml:"title"`
	URL         string `json:"url" yaml:"url"`
	MarkdownURL string `json:"markdown_url" yaml:"markdown_url"` // canonical URL + ".md"; empty outside the docs
	Page        string `json:"page" yaml:"page"`
	Snippet     string `json:"snippet" yaml:"snippet"`
}

Result is one docs search hit.

Jump to

Keyboard shortcuts

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