Is there a library available for Auto Suggest/Complete for cases like the following
Searching for “Vir” returns both “West Virginia” and “Virginia”
Thanks
EDIT
Sorry for not explaining it more. In the problem above, I do not want a “contains” search, but a prefix search on word boundaries. So “est” should not return “West Virginia”, but “wes” or “vir” should.
The list is around 500 items large.
Proposed Solution
I modified the trie implementation by Mike de Boer https://github.com/mikedeboer/trie to solve this. I split an item on word boundaries and stored each word in the trie. For the last letter of each word I stored the index of the item that the word came from in the trie node. When user searches, I return a list of indices and then get the corresponding items from the main list.
What do you guys think?
I modified the trie implementation by Mike de Boer https://github.com/mikedeboer/trie to solve this. I split an item on word boundaries and stored each word in the trie. For the last letter of each word I stored the index of the item that the word came from in the trie node. When user searches, I return a list of indices and then get the corresponding items from the main list.