I have the following requirement: -
I have many (say 1 million) values (names). The user will type a search string.
I don\'t expect the user to spell the names c
I would consider using a pre-existing solution for this.
Aspell with a custom dictionary of the names might be well suited for this. Generating the dictionary file will pre-compute all the information required to quickly give suggestions.