I'd like to sort my jQuery Autocomplete UI results based on where in the string the match occurs. The results where the match is the first letter should be prioritized above results in which the match is in the middle of the string.
A search for "M" should return:
Matt, Michael, Sam, Tim, Adam, Benjamin
Instead, since it's just returning the items in alphabetical order right now, I'm getting this:
Adam, Benjamin, Matt, Michael, Sam, Tim
Unfortunately, it looks like Autocomplete UI doesn't have any options for doing something like this, instead it just presents the results in the order it received them. Having MySql do the sorting isn't an option since all the possible matches are preloaded so that I'm not making calls to the database with every keystroke. Has anybody done anything like this?