Skip to content

Implement ranked hybrid server search with relevance ranking - #137

Merged
Flash303 merged 1 commit into
mainfrom
dev
Oct 25, 2026
Merged

Flash303 merged 1 commit into
mainfrom
dev

Conversation

@Flash303

Copy link
Copy Markdown
Owner

This pull request introduces a centralized, robust client-side server search and ranking system, replacing all previous ad-hoc filtering logic across the app. The new matcher provides consistent, relevance-ranked results for all server search surfaces, supporting typo tolerance, accent/case insensitivity, and smart tokenization. All affected components now use this shared logic, ensuring users see the best matches first.

Centralized server search and ranking:

  • Added server-search.ts implementing a hybrid, zero-dependency search matcher that normalizes text (removing color codes, accents, and case), tokenizes queries, and ranks results by strict tiers (exact, prefix, word-start, substring, 1-edit typo), with name matches always prioritized over IPs. Fuzzy matching is limited to a single edit for tokens of 5+ letters, and never applies to IPs/ports. Includes comprehensive tests. [1] [2]

Component integration and logic updates:

  • Updated useServersFilterSort hook, home page server list, account servers tab, and search bar to use the new searchServers function for all server filtering and search, replacing previous substring-based logic. This ensures consistent ranking and filtering everywhere. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

Sorting logic improvements:

  • Modified sorting logic in both the home page and useServersFilterSort so that when a search query is present, the relevance ranking from the matcher is used as the sort order, preventing secondary sorts (like by popularity or name) from burying the best matches. [1] [2] [3] [4]

Testing:

  • Added comprehensive tests for normalization, ranking behavior, fuzzy tolerance, and edge cases in server-search.test.ts, ensuring correct and robust search results.

@Flash303
Flash303 merged commit a6eb9fa into main Oct 25, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant