Title: Fuzzy Search
Author: Tobias Bäthge
Published: July 9, 2024
Last modified: May 14, 2025

---

Let the search account for spelling mistakes and typos and find similar matches.

# Fuzzy Search

The “Fuzzy Search” module allows the table search to match results that are not 
necessarily exactly the same as the search term. Rows will be found even if a search
term has typos, spelling mistakes or misspellings, partial matches, or is written
in a dialect.

By loosening the search criteria, [fuzzy search](https://cloud.google.com/discover/what-is-fuzzy-search)
or [approximate string matching](https://en.wikipedia.org/wiki/Approximate_string_matching)
improves accuracy and user satisfaction, especially for sites with a diverse audience
or complex search terms. This is ideal for ecommerce sites, educational resources,
or content-heavy platforms where users might not always type exact keywords.

## Feature description

A common example for use of fuzzy search e.g. in databases is name searching. While“
Smith” and “Smythe” are pronounced in the same way, a regular search for “Smith”
would not find “Smythe”, whereas a fuzzy search would. Other often seen cases are
spelling variations of words e.g. in British and US English, like “colour” vs. “
color”.

The following examples show some possible uses.

[Use this feature with TablePress Max today](https://tablepress.org/pricing/?output_format=md)

### Fuzzy search with toggle control

In this table with fictional data, a search for the name “Smith” is performed. Note
how rows with similar spellings of this name are also found. By hovering the mouse
over the search field, the visitor can toggle between the “exact” (on rows matching“
Smith” exactly) and the “fuzzy” search (similar rows are found as well).

To test this yourself, change the search term e.g. to “Mayer”.

  |  First Name | Last Name | ZIP | Points | Average |  
   |  Gloria | Smythe | 67439 | 4 | 0.1 |

### Showing the similarity score

To find all rows that match when doing a “fuzzy” search, the search algorithm calculates
a “similarity score”, which can be interpreted as the percentage or degree to which
the search term matches the row data. Showing this to the site visitor can give 
hints about the confidence for the search results. This table shows an example, 
see the last column:

  |  First Name | Last Name | ZIP | Points | Average | Similarity |  
   |  Gloria | Smythe | 67439 | 4 | 0.1 |  |  
 |  Graham | Bonner | 90727 | 4 | 0.9 |  |  
 |  Warren | Wheeler | 99134 | 2 | 0.7 |  |  
 |  Zena | Hale | 19803 | 9 | 0.3 |  |  
 |  Julia | Haupt | 24116 | 10 | 1.0 |  |  
 |  Rachel | Smith | 58951 | 7 | 0.3 |  |  
 |  Lionel | Barry | 65036 | 7 | 0.5 |  |  
 |  Zena | Miller | 16874 | 5 | 0.6 |  |  
 |  Dillon | Bradford | 91543 | 7 | 0.4 |  |  
 |  Haley | Mcleod | 99321 | 4 | 0.1 |  |  
 |  Abra | House | 99537 | 6 | 0.1 |  |  
 |  Ariel | Smyth | 56555 | 6 | 0.7 |  |  
 |  Roary | Ayers | 12720 | 3 | 0.5 |  |  
 |  Mason | Moller | 81062 | 3 | 0.6 |  |  
 |  Gillian | Simon | 69137 | 10 | 0.7 |  |  
 |  Rebekah | Fisher | 32572 | 3 | 0.7 |  |  
 |  Cameron | Walls | 18788 | 2 | 0.2 |  |  
 |  Phelan | Meyer | 95413 | 6 | 0.2 |  |  
 |  Mona | Fischer | 48912 | 9 | 0.6 |  |  
 |  Rashad | Webb | 27993 | 4 | 0.1 |  |  
 |  Brandon | Kinney | 00986 | 2 | 0.2 |  |  
 |  Sacha | Gould | 17722 | 8 | 0.7 |  |  
 |  Brenda | Osborn | 52139 | 4 | 0.5 |  |  
 |  Sophia | Meier | 79688 | 3 | 0.2 |  |  
 |  Bree | Orr | 70160 | 9 | 0.7 |  |  
 |  Yen | Bernard | 99216 | 1 | 0.3 |  |  
 |  Lacota | Le | 64964 | 10 | 0.7 |  |  
 |  Nayda | Horton | 42308 | 10 | 0.1 |  |  
 |  Lee | Navarro | 48918 | 5 | 0.4 |  |  
 |  Margaret | Austin | 26181 | 7 | 0.3 |  |  
 |  Brynne | Randolph | 68523 | 8 | 0.9 |  |  
 |  Oleg | Mayer | 32249 | 9 | 0.4 |  |  
 |  Mark | Cooley | 54923 | 3 | 0.2 |  |  
 |  Brendan | Sharp | 47511 | 1 | 0.5 |  |  
 |  Holly | Carrillo | 71689 | 1 | 0.3 |  |  
 |  Kelsey | Moses | 27661 | 5 | 0.8 |  |  
 |  Geraldine | Tyson | 98049 | 3 | 0.6 |  |  
 |  Jasper | Maier | 92329 | 3 | 0.5 |  |  
 |  Noble | Conley | 14869 | 8 | 0.5 |  |  
 |  Natalie | Luna | 66637 | 8 | 0.7 |  |  
 |  McKenzie | Powell | 86259 | 9 | 0.4 |  |  
 |  Tyler | Dennis | 13676 | 6 | 0.2 |  |  
 |  Vladimir | Jefferson | 78569 | 7 | 0.3 |  |  
 |  Brett | Pena | 14218 | 1 | 0.8 |  |  
 |  Demetrius | Key | 67985 | 2 | 0.4 |  |  
 |  Gwendolyn | Schmitt | 97324 | 1 | 0.8 |  |  
 |  Marvin | Middleton | 10141 | 2 | 0.7 |  |  
 |  Nadine | Walters | 27484 | 6 | 0.7 |  |  
 |  Claire | Schmidt | 54218 | 5 | 0.4 |  |  
 |  Jimmy | Miller | 41123 | 6 | 0.5 |  |

### Further details

Besides this “ranking column” that shows the similarity score and the toggle control
that the site visitor can use to switch between “exact” and “fuzzy” search, the 
feature module also allows to configure the “threshold” at which a search results
is said to be matching the search term.

## Usage instructions

To use these features with your tables, activate the “Fuzzy Search” feature module
on the “Modules” screen of TablePress Max. Then, configure the desired options in
the “Fuzzy Search” section on the table’s “Edit” screen. You can fine-tune settings
in the “Advanced settings” of that section as well.

![Screenshot of the "Fuzzy Search" configuration section in TablePress Max.](https://
tablepress.org/wp-content/uploads/2024/11/datatables-fuzzysearch.png)

The “Fuzzy Search” configuration section in TablePress Max.

## Configuration parameters

To configure this module’s features, you can also use these [configuration parameters](https://tablepress.org/faq/configuration-parameter-reference/)
in the “TablePress Table” [block](https://tablepress.org/faq/documentation-tablepress-table-block/),
the Elementor widget, or in the [Shortcode](https://tablepress.org/faq/documentation-shortcode-table/)
that you are using to embed the table:

  |  Module | Slug |  | Configuration parameter | Name | Description | Type | Default value |  
   |  Fuzzy Search | datatables-fuzzysearch |  | datatables_fuzzysearch | Fuzzy Search | Whether to activate fuzzy search for the table. | boolean (`true` or `false`) | `false` |  
 |  Fuzzy Search | datatables-fuzzysearch |  | datatables_fuzzysearch_threshold | Fuzzy Search Threshold | Similarity score that needs to be reached.
  The threshold, a number between 0 and 1, defines the similarity that is required for a row to be found. | float | `0.5` |  
 |  Fuzzy Search | datatables-fuzzysearch |  | datatables_fuzzysearch_togglesmart | Fuzzy Search Toggle control | Whether to allow the visitor to switch between exact and fuzzy search. | boolean (`true` or `false`) | `true` |  
 |  Fuzzy Search | datatables-fuzzysearch |  | datatables_fuzzysearch_rankcolumn | Fuzzy Search Rank Column | The column number for a rank column that should show the search’s similarity score. | string | `""` (empty string) |

The “Fuzzy Search” feature module is part of the [**TablePress Max plan**](https://tablepress.org/pricing/?output_format=md).

**On this page**

 1. [Feature description](https://tablepress.org/modules/datatables-fuzzysearch/#feature-description)
 2.  a. [Fuzzy search with toggle control](https://tablepress.org/modules/datatables-fuzzysearch/#grouping-by-a-single-column)
     b. [Showing the similarity score](https://tablepress.org/modules/datatables-fuzzysearch/#grouping-by-multiple-columns)
     c. [Further details](https://tablepress.org/modules/datatables-fuzzysearch/#further-details)
 3. [Usage instructions](https://tablepress.org/modules/datatables-fuzzysearch/#instructions)
 4. [Configuration parameters](https://tablepress.org/modules/datatables-fuzzysearch/#configuration)