lewang / flx

Fuzzy matching for Emacs ... a la Sublime Text.
GNU General Public License v3.0
519 stars 37 forks source link

Possible bug in the matching algorithm #33

Closed bbatsov closed 11 years ago

bbatsov commented 11 years ago

Given those two files:

~/projects/clojure-mode/clojure-mode.el ~/projects/prelude/core/prelude-mode.el

and the search text pre-mode, the first file gets selected by flx, although I think it should be the second one.

screen shot 2013-07-23 at 2 45 16 pm

lewang commented 11 years ago

The sorting algorithm tries to balance between word beginnings and contiguous matches. The longer the substring match, the higher it scores. This is a corner case where "re-mode" is just too good a substring match.

If we adjust the scoring, I'm sure other corner cases will pop up.

In general, it's better to not use word separators and let the algorithm do something smart. Here, "premode" would give you the order you expected.

bbatsov commented 11 years ago

Maybe such details about the work of the algorithm should be mentioned in the README?

bbatsov commented 11 years ago

Thanks!