Fuzzy search finds similar words and is very useful in terms of handling spelling errors made while searching on a website.

How fuzzy search works?

Fuzzy search works by using mathematical formulae that calculate the distance (or similarity between ) two words. One such commonly used method is called the Levenshtein distance.

Mathematically, the formula is (which we will not discuss in this article)

Here we will use certain examples to illustrate this-

For example, when you do a search for **fitbt **in expertrec’s custom search, these are the results we get which shows the fuzzy search at work.

As you can see, the first result is **fitbit. **

Now lets calculate the levenshtein distance between the words **w1=fitbt and w2=fitbit**

Levenshtein distance =1

Now to understand why fitness doesnt come for the search query fitbt, lets calculate the levenshtein distance between the words **w1=fitbt and w2=fitness.**

As you can see in the image below, levenshtein distance =4

When the levenshtein distance is more, the words are more dissimilar and come lower in search results .

Create your own fuzzy search engine here.