fix(desktop): rank topbar channel results by relevance, not alphabetically#2405
Open
tlongwell-block wants to merge 1 commit into
Open
fix(desktop): rank topbar channel results by relevance, not alphabetically#2405tlongwell-block wants to merge 1 commit into
tlongwell-block wants to merge 1 commit into
Conversation
…cally
The ⌘K topbar channel section used naive substring matching sorted
alphabetically, then capped at 5 — so a query like "buzz" over 61
buzz-* channels could never surface buzz-security (49th alphabetically),
and separator-tolerant queries ("buzz security", "buzzsec") matched
nothing at all. The channel browser already solved both with its banded
fuzzy scorer.
Reuse scoreChannelMatch for the topbar section via a small pure ranking
helper: relevance-ordered (score band, alphabetical tiebreak), same
visibility rules (archived only for members; open or member), label
overrides scored as the display name with the raw channel name kept
searchable, cap of 5 unchanged.
Co-authored-by: Tyler Longwell <tlongwell@block.xyz>
Signed-off-by: Tyler Longwell <tlongwell@block.xyz>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The ⌘K topbar channel section had two compounding limiters (surfaced while investigating the buzz-security discovery incident — the incident itself was the deployed relay image missing #2181; this is the separate, real client defect found along the way):
slice(0, 5). Replayed against the live channel list: querybuzzhas 61 matches andbuzz-securityranks 49th alphabetically — it could never appear.buzz security(space for hyphen) orbuzzsecmatched nothing at all.The Channel Browser (⌘⇧O) already solves both with its banded fuzzy scorer (
channelSearchScore.ts); the topbar just wasn't using it.Fix
New pure helper
features/search/lib/channelResultRanking.tsreusingscoreChannelMatch:useSearchResults.tschannel memo now delegates to the helper.Testing
channelResultRanking.test.mjscovering the two original failure modes (buzzburying an exact match,buzz security/buzzsecfindingbuzz-security), visibility filtering, label override + raw-name fallback, description band, and the cap.pnpm typecheckandpnpm checkclean.