I'm in the process of creating an a search input for restaurants with autocomplete. I was wondering if it would be best for me to require a minimum amount of characters before returning suggested results. One of the main reasons I ask is if a user types in the letter a, then the user will get a maximum of let's say, 10 results with restaurants that start with that particular letter. What would be the best way to approach this?
I was wondering if it would be best for me to require a minimum amount of characters before returning suggested results.
No, don't wait. Very often we don't know correct spelling of strange or unusual names and even second character may be a beat. Imagine one of these two situations:
- You want to have dinner at your favorite French restaurant Le Taureau. You remember sound of its name but is second character a or o or u?
- Your new girlfriend is crazy for Russian food and she told you her favorite restaurant is named Bull alas Телец. She even made spelling then you start typing T then e. Ooops second character is not Latin e but Russian е (Ye). You won't have any match.
What would be the best way to approach this?
When it's technically possible you should order them. If you can get user's location then they can be ordered by distance otherwise by user preferences/history (does he love ethnic food? Asian cuisine?).
Even when it doesn't give the right result your users will feel they have a personalized experience.
Don't forget that typeahead and search results are different things, Your search results shouldn't include only restaurants that starts with typed word but all of them which contains that word (see also Substring search vs Starting letter search). To handle second case (Russian restaurant) well you should also perform some sort of normalization, if not in your typeagead at least in your search results, you may read How can I perform a Unicode aware character by character comparison? for some (maybe) funny technical details.
Wait for it ...
The other answers are pointing you in the right direction, but leaving out an important point: Time. Just because the system can be faster than the speed of thought, doesn't mean it should be.
In a very performant system (and shouldn't they all be), you could start returning suggestions that are seemlingly instantaneous. But, you are right to assume that single letter suggestions will often just produce distraction.
If you program in a small delay before returning the first suggestions (I like to start testing around 600ms), most users will be on to the second or third character before anything comes back. You avoid interrupting the average user's train of thought (average being those with more than one character in mind).
For those that really want to get blasted with random suggestions, they'll type a single character and then pause. The slight mental delay while they anticipate suggestions should align with your programmed delay and all will be well.
Start it with the first character, imo. You want to immediately show the user what to expect from this.
Think of it like this: I want to type in the name of something, I look at the form, I type a keystroke (or two) and then realize I can't spell it... now I'm off looking it up.
the immediate feedback on the first keystroke is much better. as you said, you should definitely be limiting the list of results.