Documentation
¶
Index ¶
- func Add(root, id string, input NewConcept, force bool) (string, error)
- func CanonicalID(value string) (string, error)
- func IsSingleBundleRoot(root string) (bool, error)
- func Move(root, oldID, newID string) (int, error)
- func UpdateIndexes(root string, checkOnly bool) ([]string, error)
- type Backlink
- type Bundle
- func (b *Bundle) Backlinks(id string) ([]Backlink, error)
- func (b *Bundle) ConceptPath(id string) (string, string, error)
- func (b *Bundle) ConceptsUnder(prefix string, recursive bool) []*Concept
- func (b *Bundle) Get(id string) (*Concept, error)
- func (b *Bundle) Graph(id string, maxDepth int) ([]GraphNode, error)
- func (b *Bundle) Outgoing(id string) ([]Link, error)
- type BundleValidationStats
- type Concept
- type ConceptRef
- type Confidence
- type GraphNode
- type Issue
- type Link
- type Match
- type NewConcept
- type ScoreRank
- type SearchOptions
- type SearchResult
- type SearchResultRef
- type ValidationReport
- type ValidationStats
- type Workspace
- func (w *Workspace) Mode() WorkspaceMode
- func (w *Workspace) QualifyID(bundleName, localID string) string
- func (w *Workspace) ResolveConcept(value string) (*ConceptRef, error)
- func (w *Workspace) ResolveDirectory(value string) (*Bundle, string, string, error)
- func (w *Workspace) Search(query string, options SearchOptions) ([]SearchResultRef, error)
- func (w *Workspace) Validate(strict bool) (ValidationReport, error)
- type WorkspaceMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanonicalID ¶
func IsSingleBundleRoot ¶
IsSingleBundleRoot reports whether root uses the single-bundle mode.
Types ¶
type Bundle ¶
type Bundle struct {
Root string
Title string
Concepts []*Concept
ByID map[string]*Concept
Markdown map[string]string
}
func (*Bundle) ConceptsUnder ¶
ConceptsUnder returns concepts in a directory, optionally including nested directories.
type BundleValidationStats ¶
type ConceptRef ¶
ConceptRef identifies a concept together with the bundle that owns it.
type Confidence ¶ added in v1.3.0
type Confidence int
Confidence is the semantic confidence tier of a match, ordered from strongest to weakest. The enum value is the tier; String returns its stable wire name for rendered JSON.
const ( // ConfidenceHigh covers exact and phrase matches. ConfidenceHigh Confidence = iota // ConfidenceMedium covers structured metadata matches. ConfidenceMedium // ConfidenceLow covers weak lexical matches. ConfidenceLow )
func (Confidence) String ¶ added in v1.3.0
func (c Confidence) String() string
String returns the stable machine-readable wire name of the tier.
type Match ¶ added in v1.3.0
Match records why a concept matched a query. It is the search evidence exposed in rendered JSON as matched_fields, matched_terms, and matched_rank. Coverage is the fraction of query tokens that matched (0..1) and feeds the confidence tier, so a single tag hit on a three-token query is not medium.
type NewConcept ¶
type ScoreRank ¶ added in v1.3.0
type ScoreRank int
ScoreRank is the semantic class of a match, ordered from strongest to weakest. The enum value is the rank; Weight returns its fixed score contribution. Ranks are ordinal, so comparisons like "stronger than a description match" are expressed as rank comparisons instead of magic numbers.
const ( // RankExactID is a direct concept-ID lookup, the highest-confidence path. RankExactID ScoreRank = iota // RankTitlePhrase is the normalized query appearing verbatim in the title. RankTitlePhrase // RankDescriptionPhrase is the normalized query appearing verbatim in the // description. RankDescriptionPhrase // RankTitle is a token match in the title. RankTitle // RankTag is a token match in the tags. RankTag // RankDescription is a token match in the description. RankDescription // RankID is a token match in the concept ID path. RankID // RankBody is a token match in the body. RankBody )
func (ScoreRank) Confidence ¶ added in v1.3.0
func (r ScoreRank) Confidence(coverage float64) Confidence
Confidence returns the semantic confidence tier of a match: high for exact and phrase matches and full-coverage metadata matches; medium for metadata matches covering more than half of the query tokens and description matches covering all of them; low for weak lexical matches and sparse hits. Coverage-aware tiers prevent a single tag or title hit on a multi-token query from masquerading as a confident match.
type SearchResult ¶
func Search ¶
func Search(bundle *Bundle, query string, options SearchOptions) []SearchResult
Search ranks concepts by lexical relevance. An exact concept-ID query short-circuits with a perfect match; otherwise scoring uses normalized tokens with boundary matching, a phrase bonus, and per-field weights.
type SearchResultRef ¶
SearchResultRef is a workspace-qualified search result.
type ValidationReport ¶
type ValidationReport struct {
Errors []Issue
Warnings []Issue
Stats ValidationStats
Bundles []BundleValidationStats
}
func ValidateWorkspaceRoot ¶
func ValidateWorkspaceRoot(root string, strict bool) (ValidationReport, error)
ValidateWorkspaceRoot validates a single bundle or all direct child bundles without loading concepts into the in-memory Bundle model first.
func (*ValidationReport) AddError ¶
func (r *ValidationReport) AddError(path, message string)
func (*ValidationReport) AddWarning ¶
func (r *ValidationReport) AddWarning(path, message string)
func (ValidationReport) Sort ¶
func (r ValidationReport) Sort()
func (ValidationReport) Valid ¶
func (r ValidationReport) Valid() bool
type ValidationStats ¶
type Workspace ¶
Workspace coordinates one bundle or a directory containing direct child bundles.
func LoadWorkspace ¶
LoadWorkspace loads root as one bundle or discovers its direct child bundles.
func (*Workspace) Mode ¶ added in v1.3.0
func (w *Workspace) Mode() WorkspaceMode
Mode reports how this workspace interprets its root.
func (*Workspace) QualifyID ¶
QualifyID converts a bundle-local ID to the CLI ID for this workspace.
func (*Workspace) ResolveConcept ¶
func (w *Workspace) ResolveConcept(value string) (*ConceptRef, error)
ResolveConcept resolves a local ID in a single bundle or a qualified ID in a workspace.
func (*Workspace) ResolveDirectory ¶
ResolveDirectory resolves a workspace directory path to its owning bundle and local prefix. An empty prefix in workspace mode refers to the workspace itself and returns a nil bundle.
func (*Workspace) Search ¶
func (w *Workspace) Search(query string, options SearchOptions) ([]SearchResultRef, error)
Search searches all bundles, applying a qualified path filter when supplied.
type WorkspaceMode ¶ added in v1.3.0
type WorkspaceMode int
WorkspaceMode describes how a workspace root is interpreted: as one bundle or as a directory of child bundles. The enum value is the mode; String returns its stable wire name for rendered JSON.
const ( // ModeWorkspace treats the root as a directory of child bundles. ModeWorkspace WorkspaceMode = iota // ModeSingle treats the root as one bundle. ModeSingle )
func (WorkspaceMode) String ¶ added in v1.3.0
func (m WorkspaceMode) String() string
String returns the stable machine-readable wire name of the mode.