post-hero-img

What is Fuzzy Search?

Site search

Fuzzy search, also known as fuzzy matching, has various interpretations, all of which revolve around the concept of approximate matching. It employs a fuzzy matching algorithm, which gives a list of results based on potential relevance even if the search argument phrases and spellings do not match exactly.

It is especially beneficial for assisting visitors in finding content even if they don’t know exactly what they are looking for.

When fuzzy matching is used in a search engine, improperly worded searches can still successfully yield correctly spelled results. It could also, for example, identify colloquialisms in the wording or amend incorrectly formed queries.

pinot noir

Where is Fuzzy Logic Used?

Fuzzy logic enables a computer to consider multiple options, or degrees of truth, when evaluating data rather than the traditional “true or false” (1 or 0) Boolean logic on which current computers are built.

It allows computers to look at problems like humans and is beneficial for developing intelligent systems that solve decision-making, identification and pattern recognition problems.

logic

Fuzzy logic has been beneficially used in different fields such as pattern recognition, classification for speech recognition, handwriting recognition, facial characteristic analysis, and image search.

Perhaps the most commonly used instance of fuzzy logic is fuzzy search.

Integrated into the search engine using programming languages such as Javascript or Python, fuzzy search helps find complicated terms, unfamiliar phrases and foreign languages to make the search process much more manageable.

How Does Fuzzy Search Work?

It works by identifying and matching two strings or keywords that may be similar but aren’t exactly the same.

A fuzzy search can be used to locate web pages that are likely to be relevant to a search query even when the query does not exactly correspond to the desired content.

Let’s look at the following example; a user types out the query “Good food joints for a date”, the fuzzy matching algorithm on the search engine would be able to pick up and recognise the use of a colloquialism and accurately show results matching “Romantic restaurants near me”.

restaurant Converted

Fuzzy search uses a wide range of criteria to evaluate results. It provides more context to the search terms you enter, so you can find the information you want even if it’s not exactly what you typed.

It does this by understanding what you’re trying to do, based on what you type. It looks at both the words and the context of those words and tries to figure out what you’re trying to say.

Fuzzy search works by looking for strings similar to a given string and goes beyond textual matching to measure its similarity.

So how can we measure the similarity between two strings (a and b)? Let’s have a look at a few ways this is done.

Understanding Fuzzy Matching With Real World Examples

Fuzzy Name Matching Algorithms

Typo are inevitable; it happens and can reduce user experience; fortunately, modern search engines can handle it easily using fuzzy matching.

It does this by calculating how many editing operations it takes to go from string a to string b. This is commonly known as Edit Distance.

There are three types of edit distance operations:

1)   Hamming Distance

This is the simplest form of edit distance, where we measure the number of letters that need to be replaced to go from string a to string b. Let’s see a few examples:

* d = Distance

●     d(“dog” to “log”) = 1, replace the first letter (‘d’ with ‘l’)

AdobeStock 343016715

●     d(“bat” to “lag”) = 2, replace the first letter (‘b’ with ‘l’) and third letter (‘t’ with ‘g’)

Hamming distance in fuzzy search only deals with replacing letters and cannot define where additional letters need to be added. E.g.:

●     d(“bark” to “barks”) is conventionally not defined because it cannot be achieved by replacing letters.

It is also bad at dealing with misaligned statements.

●     “Hamming distance” to “Hammingdistance”

2)   Levenshtein Distance

For understanding natural language, Levenshtein distance is better suited to fuzzy search than Hamming distance.

It has three operations (substitution, insertion and deletion) instead of just one.

The distance in Levenshtein Distance is defined by the number of edits it takes to go from string a to string b. For example:

●     d(“bark” to “barks”) = 1, since (bark > barks)

●     d(“monsoon” to “moon”) = 3, since (monsoon > mnsoon > msoon > moon)

●     d(“knight” to “knigth”) = 2, since (knigth > knigh > knight)

It also deals better with misaligned strings.

●     d(“Hamming distance”, “Hammingdistance”) = 1, insert “ “ instead of replacing “d” > “ “

3)   Damerau–Levenshtein Distance

AddSearch uses Damerau–Levenshtein distance as its algorithm of choice for fuzzy text matching.

It offer the same operations as Levenstein distance and additionally allows for adjacent characters to be swapped.

●     d(“knight, “knigth) = 1, since (knigth > knight) by replacing the positions of t and h in one step.

Boost sales by increasing conversion

Find out the site search priorities for Retail & eCommerce – download the State of Site Search 2022 report now!

New call-to-action

Example of Fuzzy Search in Action

Now that we know what fuzzy search is, let’s take a deep dive and look at some examples of how fuzzy search works behind the scenes.

Let’s assume a user logs in to the AddSearch website and types in the word “search”.

Behind the UI, the query without fuzzy search on would look somewhat like this –


Request
https://api.addsearch.com/v1/search/1bed1ffde465fddba2a53ad3ce69e6c2?term=search

Response
{
"page": 1,
"total_hits": 221,
"processing_time_ms": 18,
"hits": [...],
"facets": null,
"fieldStats": null,
"rangeFacets": null,
"hierarchicalFacets": null
}

So the request for the query “search” yielded 221 hits. That’s awesome, but what happens when the user accidentally omits the “a” from the search? Let’s have a look –


Request

https://api.addsearch.com/v1/serch/1bed1ffde465fddba2a53ad3ce69e6c2?term=serch 

Response
{
"page": 1,
"total_hits": 0,
"processing_time_ms": 13,
"hits": [...],
"facets": null,
"fieldStats": null,
"rangeFacets": null,
"hierarchicalFacets": null
}

As we discussed earlier, without fuzzy search activated, the search engine shows only exact matches, and as a result, we get zero hits.

Now let’s look at the same example with fuzzy search activated –


Request

https://api.addsearch.com/v1/search/1bed1ffde465fddba2a53ad3ce69e6c2?term=serch&fuzzy=true 

Response
{
"page": 1,
"total_hits": 221,
"processing_time_ms": 18,
"hits": [...],
"facets": null,
"fieldStats": null,
"rangeFacets": null,
"hierarchicalFacets": null
}

221 hits, much better! With fuzzy search activated, we quickly eliminated any problems the users may have faced due to typos.

It’s important to note that in terms of relevance, exact textual matches (i.e. records with a 0 distance) are considered more relevant than fuzzy matches based on spelling differences. They are ranked higher in the search results. As the distance increases, the lower the ranking becomes.

E.g.- records with 1 typo are ranked higher than records with 2 typos etc…

How to Implement Fuzzy Search?

When you choose an advanced search solution such as AddSearch, you don’t need to worry about separately implementing the fuzzy search functionality, as this and other advanced features come pre-configured into the search experience.

See the video below to learn how to design and install AddSearch to your website in 4 easy steps.

HOW TO SETUP AND EDIT YOUR SITE SEARCH from AddSearch on Vimeo.

Conclusion

Whether you call it “fuzzy query”, “fuzzy text matching”, “fuzzy logic search”, or even “fuzzy string search”, all that matters is you understanding that it is an essential component of a good search experience. It enhances the search experience by making spelling, grammar and formatting errors a non-issue when ranking pages.

Talk to our team or book a demo to see how fuzzy search and the other advanced features offered with AddSearch can help increase your ROI.

What does fuzzy search mean?

The phrase fuzzy search has various interpretations, all of which revolve around the concept of approximate matching.

How fuzzy search works?

It employs a fuzzy matching algorithm which gives a list of results based on potential relevance even if the search argument phrases and spellings do not match exactly.

Where is fuzzy logic used?

Fuzzy logic has been used in fields such as pattern recognition, classification for speech recognition, handwriting recognition, facial characteristic analysis, and image search. Perhaps the most commonly used instance of fuzzy logic is fuzzy search.

How to implement fuzzy search?

When you choose an advanced search solution such as AddSearch, you don’t need to worry about separately implementing fuzzy search functionality, as this and other advanced features come pre-configured into the search experience.

addsearch book

Experience the Best in Search Solutions with AddSearch – Top Rated on SourceForge! Click for Your Free, Personalized Demo Now.

New call-to-action

Was this helpful?

Share this: