toolsearch

package
v0.783.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package toolsearch ranks registry tools against a free-text query so an operator can find the right tool by task ("garage door", "wifi password", "decode nfc card") instead of guessing its exact name. With 600+ tools, the only discovery affordance was a name-substring filter; this adds task-oriented search across every surface that reaches the registry.

The ranking is deterministic and offline: the same query always yields the same order (ties broken by tool name — a tiebreak-less sort would flake, see the Sub-GHz classifier fix), and the score is a field-weighted token overlap over each tool's name / aliases / group / description, plus a small curated domain synonym map so task words reach the technical terms the tools actually use. No "confidently wrong" risk: a ranking is advisory; a poor match is merely lower-ranked, never asserted as the answer.

Wrap-vs-native: native — a tokenizer + weighted set-overlap scorer, stdlib only, no search-index or embedding dependency.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Doc

type Doc struct {
	Name        string
	Aliases     []string
	Group       string
	Description string
}

Doc is one searchable tool: the registry fields the ranker scores over.

type Result

type Result struct {
	Name    string   `json:"name"`
	Score   float64  `json:"score"`
	Matched []string `json:"matched,omitempty"`
}

Result is one ranked match. Matched lists the query/synonym terms that hit, sorted, so the caller can show why a tool surfaced.

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

Search returns the tools whose fields best match query, highest score first, at most limit results (limit <= 0 = unbounded). A zero-score tool is omitted.

Jump to

Keyboard shortcuts

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