Documentation
¶
Overview ¶
Package search is bumper's unified, cross-corpus rule search. It builds a single in-memory BM25 index over BOTH corpora — the enforced rules (which fire on a plan) and the embedded advisory catalog (Trivy/Checkov/KICS/Prowler knowledge) — then re-ranks with a small custom policy (enforced boost + severity + source priority).
It is deliberately hand-rolled (stdlib only): the corpus is ~2,800 short docs, BM25 is stable write-once math, and a transparent scorer fits bumper's single-static-binary, CGO-free, auditable supply chain better than pulling in a full-text-search engine. Heavy machinery (semantic/vector, hybrid RRF) is reserved for the hosted Advisor, which has no CGO/offline constraint.
Index ¶
Constants ¶
const DefaultLimit = 30
DefaultLimit caps results when Query.Limit is unset.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Doc ¶
type Doc struct {
Corpus string // "enforced" | "advisory"
Enforced bool // true for the executable rule set
Rule *rules.Rule // set iff enforced
Entry *catalog.Entry // set iff advisory
// contains filtered or unexported fields
}
Doc is one searchable document spanning both corpora. Exactly one of Rule / Entry is set; callers render from the back-pointer so we don't duplicate fields. The lowercase fields are the indexed text.
type Hit ¶
Hit is a ranked document: Score is the final re-ranked score, Relevance is the raw BM25 contribution (used for the topicality floor).