How to Improve User Search Experience

Lessons on word perception

How to Improve User Search Experience

Lessons on word perception

Recently I had a chance to work on a project that was heavily focused on search and filtering features. Think - a single command bar that allows customers to write anything and suggest them exactly what they need.
We had quite a bit of fun doing this project, and also got a chance to dig through some old university papers regarding natural language processing, word perception, and overall talking-with-the-machine experience.
I won’t be going through the entire NLP course right now, but I want to point out the most interesting lessons based on this small research. (Also, all should be very easy to use in your own projects, regardless of skill level or technology used!)

How not to create search

Note I assume you are not using a ready search solution like Algolia. We are building an application with some kind of database that should be browsable by the user, and the entire responsibility lies on you and your programming.
What do people usually do to create search in the most straight-forward and somehow intuitive way? The most common approach I met was simply to take input from the user and filter the database with it - if the input matches row in any way, that’s a hit.
/input/
And it works. I remember building an entire server-management platform using this approach at some point.
It has flaws though. This will only work for small sets of items. For any set bigger than 50 items it will start to suggest plenty of unwanted results.

Olny fsirt ltertes metatr

As suggested by various scientific research papers - our brains don’t really care about the order of characters in words. Except for the first and the last letter. The rest can be shuffled, scrambled, and randomised, and most of us will still be able to read the word without much issue.
Since our brains refuse to identify words by their middle part arrangements, so should your search implementation.
User searching for Al is likely to look for Alabama, Alexandria, or Great Alaska. They are unlikely to be looking for Sundsvall or California (Really. Just try to think about any city with al in the middle. You will automatically fallback to only the cities that start with Al).
So to improve your search, instead of blindly matching any part, use Regex to search only beginnings of words.
/((^|\s)input.*)/
Note, that it is important to search not only beginnings of items. Treat each word as a possible match.

Exceptional case for endings

In some specific cases, like surnames, it may also be smart to allow searching the endings of words. Names and complex words tend to have memorable suffixes users may want to search by.
((^|\s)input.*)|(.*input($|\s))

Nicely ordered - as all things should be

The last important lesson is the order of results shown to the user.
If you don’t store any tracking of which items are clicked most by users, in which case you would order by such tracking index, we must blindly assume all results are of equal importance.
First list items in which first word was a hit, then items for which second word was a hit, and so on. In some cases, it may also be a good idea to sort the final results alphabetically by the reminder of the word hit.
If you are matching word endings as well, be sure to display them at the end of results. Even though sometimes useful, these are significantly less important than matching word beginnings.

Final thoughts

If you would like to learn more about using regex in various situations, check this guide by Mozilla.
It is also extremely handy to use regex101.com platform to debug your expressions.
wtl studio amsterdam logo
WTL Studio
Herengracht 499
1017 BT Amsterdam
The Netherlands
Monday - Friday
8 am - 6 pm
2016-2020 WTL Studio Amsterdam
KVK 68175922