improve the search algorithm

1. sort the array
2. stop compare after the last match string