-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Description
Summary
The current leaderboard search uses simple string matching (.toLowerCase().includes()), which requires exact substring matches. Upgrading to fuzzy search would improve user experience.
Current Implementation
// src/components/leaderboard.tsx:141
user.username.toLowerCase().includes(searchTerm.toLowerCase())This requires exact matches - searching "shwa" won't find "shaw".
Proposed Enhancement
Use fuzzysort (already in package.json but unused) for typo-tolerant matching:
import fuzzysort from 'fuzzysort';
// Instead of exact matching:
const filteredUsers = fuzzysort.go(searchTerm, users, { key: 'username' })
.map(result => result.obj);Benefits
- Typo tolerance: "shwa" → finds "shaw"
- Partial matching: "wtfis" → finds "wtfisagi0"
- Ranked results: Best matches appear first
- Fast: Optimized for real-time filtering
Context
fuzzysortwas added in commit4fe3c624(2025-01-21) during SQLite implementation- Search UI was added in PR Fetch all users score and add pagination + search feature fix #92 but used simple matching
- Package is already installed, just needs to be imported and used
Related
- See chore: Remove 10 unused dependencies #173 for dependency audit (lists
fuzzysortas currently unused)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels