I am currently keeping an index of all our client's usernames. The search
functionality is implemented using a PrefixFilter. However, we would like to
expand the functionality to be able to search any part of a user's name,
rather than requiring that it begin with the query string. So for example,
the search term 'mit' would return the username 'smith'.
I am hesitant to use a WildcardQuery starting with an asterisk because I've
read about why this is a bad idea. I am looking for suggestions on the best
way to implement this.
The idea I've come up with is to index each part of the username; so for
example, if the username is 'mark', you would index mark, ark, rk, and k.
Then you could still use the PrefixFilter. I'm not overly concerned about
how this would enlarge the index because usernames tend to be fairly short.
I am very much open to other suggestions however. Does anyone have any
opinions or ideas that they can share?
Thanks very much.