Split search results into 'exact matches' and 'fuzzy matches'.

- also refactored the javascript.