NorfairKing / bevel

Other
36 stars 3 forks source link

Possible algorithm improvement #10

Open ursi opened 1 day ago

ursi commented 1 day ago

One thing that annoys me about the current algorithm is that sometimes it prioritizes better matches over more recently used things. I assume this is because we're using a fuzzy finder to match things, and we need to strike a balance somewhere between how much something matches and how frequently it is used. I think we would see improvements if we did a first pass treating all commands that contain your text as a substring as equally matching, and weighted them by frequency only, and then used the fuzzy finder on a second pass.

Example: there is a command I have been using in a project recently called make ghciwatch. When I type watch into bevel, I get:

  make ghciwatch
  yt-dlp .../watch...
  yt-dlp .../watch...
  yt-dlp .../watch...
  watch 
> watch
  watch|

despite make ghciwatch being the clear recency winner. I can get better results with ^h, but I'd prefer to keep the ^r muscle memory.

NorfairKing commented 1 day ago

We may have to try out implementing a suggestion before we can evaluate it.

The algorithm is here, in case you want to try that: https://github.com/NorfairKing/bevel/blob/f15848bdae26e6846b9856beed648e47908a1383/bevel-select/src/main.rs#L404