leftwm / leftwm-theme

A tool to help manage themes for LeftWM
BSD 3-Clause "New" or "Revised" License
117 stars 12 forks source link

search: Improve the search matcher #22

Closed darkowlzz closed 3 years ago

darkowlzz commented 3 years ago

Introduces fuzzy matcher to improve the theme search.

I observed the following results in the theme search:

$  ~ leftwm-theme search orange
Searching for themes with similar names . . .
$  ~ leftwm-theme search "Orange For"
Searching for themes with similar names . . .
   community/Orange Forest: A LeftWM theme-Installed
$  ~ leftwm-theme search ng
Searching for themes with similar names . . .
   community/TNG: A LeftWM theme
$  ~ leftwm-theme search xp
Searching for themes with similar names . . .
   community/TNG: A LeftWM theme
$  ~ leftwm-theme search Windows
Searching for themes with similar names . . .
   community/Windows XP: A LeftWM theme

Edit distance string metric of 3 seems to be not helping much here. I tried to replace that with a fuzzy matcher and got some comparatively good results.

NOTE: I've added test cases comparing the two methods. If we agree to go with fuzzy matcher, I'll remove the edit_distance method and related tests.

mautamu commented 3 years ago

This looks great! It might be helpful to accompany this PR with the PR than finally makes theme names follow arch naming standards #9 . @darkowlzz If you want to take that on, that'd be great; otherwise will merge when I can test later today.

Best, Mau

lex148 commented 3 years ago

I had a moment to review and test. This is awesome! good work.

darkowlzz commented 3 years ago

@lex148 thanks.

@mautamu I've encountered the issue in #9 myself and wanted to fix it. Was just trying to get some more rust experience before working on it. I'll give it a try. Thanks.