Documentation
¶
Overview ¶
Package searchrank is how well a label matches what was typed into a search, as a TIER: the order the operator asked searches to list their matches in.
0 the label STARTS with the query "gpt" → "gpt-4o" 1 a WORD in the label starts with it "4o" → "gpt-4o" 2 the query is anywhere else in the label "pt" → "gpt-4o" 3 its letters appear in the label, in order "g4o" → "gpt-4o" -1 no match
Both sides are compared after Fold, and a word starts at the label's start or after any character that is not a letter or a number. An empty query (after Fold) matches everything at tier 0.
🔴 TIER 3 IS KEPT ON PURPOSE. The pickers matched letters-in-order before they were ranked, and an operator who types "g4o" or "mstr" expects the entry they always found that way. Dropped, those entries would simply vanish; kept LAST, they cannot push a better match down.
🔴 THE BROWSER HAS THE SAME RULE (appScript's window.musterRank), and testdata/cases.json is the ONE table both are held to: this package's test reads it, and e2e/tests/pickers.spec.ts runs the browser's copy over the same file. WHICH SURFACES ARE HELD TO IT:
- the dispatch dialog's task, repo and model pickers and the directory picker (window.musterRank), and the model search's server-side cut (this package) — all of them, through the table;
- NOT the chief thread search, which ranks in SQL (agents.PGStore .SearchSessions: ILIKE and a regexp, case-insensitive by Postgres's own rules, with no Fold). It agrees with the table on ASCII; outside it the differences Fold exists for (accents, final sigma, compatibility forms) are not applied there.
(The retired Agents list's filter ranked each card's titles with window.musterRank too.)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fold ¶
Fold is the ONE normalisation a label and a query go through before they are compared, spelled identically in the browser (window.musterFold):
- NFKD — compatibility forms become their plain letters and digits ("²" → "2", "𝐀" → "A") and accented letters split from their accents;
- combining marks and U+FEFF are dropped (so "é" matches "e", and a BOM pasted with a query is not a character);
- lower case, letter by letter — then the final sigma "ς" is "σ" (the browser lower-cases a word-final Σ to ς, Go never does);
- surrounding white space is trimmed.
Types ¶
This section is empty.