Documentation
¶
Overview ¶
Package search parses GitHub's search query mini-language into the structured form the domain resolves and the store filters on. It is pure: it touches no store, no git, and no HTTP, so the same raw query string always parses to the same Query. The domain layer turns the parsed qualifiers into store filters (resolving logins and repo names to ids); this package only tokenizes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizeOrder ¶
NormalizeOrder maps a direction query parameter to "asc" or "desc", defaulting to descending, which is GitHub's default for every sort.
Types ¶
type Field ¶
type Field int
Field is a target a free-text term matches against. The in: qualifier selects it; with no in: qualifier a term matches the default fields for the search kind (title and body for issues, name and description for repositories).
The fields a term can match: an issue's title or body, or its comment text.
type Query ¶
Query is a parsed search string: the free-text terms a result must contain and the qualifier:value pairs that narrow the set. A qualifier may repeat (label:bug label:urgent), so its values are a slice. Keys are lowercased; the values keep their original case because logins and repo names are matched case-insensitively downstream but rendered as written.
func Parse ¶
Parse splits a raw search string into terms and qualifiers. A token shaped key:value whose key is a recognized qualifier becomes a qualifier; every other token is a free-text term. Double quotes group spaces into one token, so `label:"help wanted"` and `"exact phrase"` parse as a single value or term. An unterminated quote runs to the end of the string, matching how GitHub tolerates a trailing quote.