I am using Twitter typeahead.js 0.10.5 as a suggestion engine. It works great, with one exception, I can\'t sort the list of suggestions the way I want.
As an example:>
To sort all matches by closeness to the input, you can take the Levenshtein distance of a
and b
. I just implemented this using fast-levenshtein and it works and performs great.
sorter: function(a, b) {
var input_string = $(selector).val();
return levenshtein.get(a.key, input_string) - levenshtein.get(b.key, input_string);
}