searchrank

package
v0.167.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func Fold(s string) string

Fold is the ONE normalisation a label and a query go through before they are compared, spelled identically in the browser (window.musterFold):

  1. NFKD — compatibility forms become their plain letters and digits ("²" → "2", "𝐀" → "A") and accented letters split from their accents;
  2. combining marks and U+FEFF are dropped (so "é" matches "e", and a BOM pasted with a query is not a character);
  3. lower case, letter by letter — then the final sigma "ς" is "σ" (the browser lower-cases a word-final Σ to ς, Go never does);
  4. surrounding white space is trimmed.

func Tier

func Tier(label, query string) int

Tier is how well label matches query; see the package doc.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL