Skip to content

#2: Implement Basic Fuzzy Search (In-Memory) #2

@cobret-git

Description

@cobret-git

Overview

Implement fuzzy search using Levenshtein distance algorithm to enable typo-tolerant project searches. Currently, users must type project names exactly; we want to find projects even with small typing mistakes (e.g., "Moahve" → finds "Mohave").

Current behavior: Search requires exact matches in project Name and Description fields.

Desired behavior: Search finds projects with up to 30% character differences (similarity threshold ≥70%), while prioritizing exact matches. Search must complete in <200ms for datasets <500 projects.

Testing Scenarios

Test 1: Single character typo

  • Setup: Database contains "Mohave Project"
  • Action: User enters "Moahve"
  • Expected: "Mohave Project" appears in results

Test 2: Multiple character typos

  • Setup: Database contains "Project Alpha"
  • Action: User enters "Prjoect"
  • Expected: "Project Alpha" appears in results

Test 3: Exact match prioritization

  • Setup: Database contains "Alpha Project" and "Alpha Beta Project"
  • Action: User enters "Alpha"
  • Expected: "Alpha Project" ranks/appears before "Alpha Beta Project"

Test 4: Minimum Length for Levenshtein Distance

  • Setup: Database contains "Apple" and "Abacus"
  • Action: User enters "Ab"
  • Expected:
    1. System identifies query length < 3
    2. Fuzzy matching is bypassed
    3. "Abacus" appears (exact prefix match)
    4. "Apple" does NOT appear (would require fuzzy/partial matching)
  • Insight: Confirms that disabling fuzzy matching for short queries doesn't break standard prefix/exact matching

Test 5: Too many errors - no match

  • Setup: Database contains "Mohave Project"
  • Action: User enters "xyz"
  • Expected: Does NOT match "Mohave Project" (similarity < 70%)

Test 6: Empty input

  • Setup: Database contains "Project Alpha", "Mohave Project", "Alpha Beta Project"
  • Action: User clears search field
  • Expected: All projects display (no filtering applied)

Test 7: Special characters in project name

  • Setup: Database contains "C# Application"
  • Action: User enters "C#-App"
  • Expected: Fuzzy matching handles special characters appropriately and finds the project

Test 8: Performance baseline

  • Setup: Database contains 500 projects
  • Action: User enters fuzzy search query "test"
  • Expected: Results return in <200ms, UI remains responsive

Test 9: Description field matching

  • Setup: Database contains project with description "database management"
  • Action: User enters "databse"
  • Expected: Project found via fuzzy match in description field

Test 10: Backward compatibility

  • Setup: Database contains "Project Alpha", "Mohave Project"
  • Action: User performs exact-match searches that previously worked (e.g., "Project", "Mohave")
  • Expected: No regression in existing search behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions