Skip to content

feat: Upgrade leaderboard search to fuzzy matching #174

@madjin

Description

@madjin

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

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions