change .contains to indexOf for searchFilter; optimize uniqueArray

Found out .contains only works in firefox.
Optimized autocomplete function by moving uniqueArray to after the foreach loop.