Sometimes, there is no escaping it, and you must accept some user’s input into your system. That sad state of affairs is problematic, because all users have one common tendencies, they are going to be entering weird stuff into your system. And when stuff doesn’t work, you’ll need to make it work, even it make no sense.
Let us take a simple example with this user, shall we?
Assuming that you have a search form for users, and a call goes to the call center, where you need to have the helpdesk staff search for that particular user.
Here are the queries that they tried:
Now, you may think poorly of the helpdesk staff (likely outsource and non native speakers), but the same thing can happen for Yasmin, Jasmyne and Jasmyn (I literally took the first two examples I found in Twitter, to show that this is a real issue).
How do you handle something like this? Well, if you are Google, you do this:
What happens if you aren’t Google? Well, since we are talking about RavenDB here, you are going to run a suggestion query, like so:
This requires us to have defined the “Users/Search” index and mark the Name field as viable for suggestions. This tend to be quite computing intensive during indexing time, but it allow us to make a suggestion query on the field, which will give us this result:
What is going on here? During indexing, RavenDB is going to generate a list of permutations of the data that is being indexed. Then, when you run a suggestion query, we can compare the user’s input to the data that has been indexed and suggest possible alternatives to what the user actually entered. This isn’t a generic selection, it is based on what you actually have in your system.
A more serious case is the international scene. When you have a user such as “André Sørina”:
How do you search for them? On my keyboard, I don’t know how to type this marks (diacritic, I had to search for that). If someone tried to tell me these over the phone, I would be completely lost. It’s a good thing that we have a good solution for that:
Which will give us:
And now we can search for that, and find the user very easily.
This is a feature that we had since 2010, but it got a serious face lift and made easier to use in RavenDB 4.0.