Documentation
¶
Overview ¶
Package samples provides search functionality over community-contributed Microsoft Graph API query samples.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildFTSDatabase ¶ added in v1.0.14
BuildFTSDatabase creates a SQLite FTS5 database from the samples index. The database contains both a content table (for returning results) and an FTS5 virtual table (for full-text search with Porter stemming).
func FormatFTSResults ¶ added in v1.0.14
func FormatFTSResults(results []FTSSearchResult) interface{}
FormatFTSResults converts a slice of FTSSearchResult into the standard JSON output format.
func WriteIndex ¶
WriteIndex serializes an Index to JSON and writes it to the given path.
Types ¶
type FTSIndex ¶ added in v1.0.14
type FTSIndex struct {
// contains filtered or unexported fields
}
FTSIndex provides full-text search over a SQLite FTS5 database containing sample data.
func LoadFTSIndex ¶ added in v1.0.14
LoadFTSIndex opens a SQLite FTS database for searching. Callers must call Close() when done.
type FTSSearchResult ¶ added in v1.0.14
type FTSSearchResult struct {
Intent string `json:"intent"`
Query string `json:"query"`
Product string `json:"product,omitempty"`
File string `json:"file,omitempty"`
MatchReason string `json:"matchReason"`
Score float64 `json:"score,omitempty"`
}
FTSSearchResult contains a sample search result with all available fields.
type Index ¶
type Index struct {
Generated string `json:"generated"`
Count int `json:"count"`
Samples []Sample `json:"samples"`
}
Index holds the full searchable samples index.
func BuildIndex ¶
BuildIndex walks a samples directory, parses all YAML files, and returns a compiled Index. This is used by CI to produce samples-index.json.
type Sample ¶
type Sample struct {
Intent string `json:"intent" yaml:"intent"`
Query interface{} `json:"query" yaml:"query"` // string or []string for multi-step
Product string `json:"product" yaml:"-"` // populated from directory name
File string `json:"file" yaml:"-"` // relative path within samples/
}
Sample represents a single community-contributed query sample.
func (*Sample) QueryStrings ¶
QueryStrings returns the query as a string slice, normalizing both single-string and multi-step list formats.
type SearchResult ¶
SearchResult wraps a sample with a relevance indicator.