New feature in TablePress 2.4!
Let the search account for spelling mistakes and typos and find similar matches.
This feature module is part of the TablePress Max plan.
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 is written in a dialect.
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.
The following examples show some possible uses.
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.
All these settings can be configured in the easy-to-use TablePress user interface, individually for each table.
Usage instructions
To make this feature available for your tables, enable the “Fuzzy Search” module on the TablePress “Modules” screen.
To use this feature with your tables, activate it in the “Fuzzy Search” section on the table’s “Edit” screen. You can then configure it in the “Advanced settings” of that section.
Configuration parameters
To configure this module’s features, you can also use these configuration parameters in the “TablePress Table” block or in the Shortcode that you are using to embed the table:
Module | Slug | Configuration parameter | Name | Description | Type | Default value | |
---|---|---|---|---|---|---|---|
Fuzzy Search | datatables-fuzzysearch | datatables_fuzzysearch | boolean (true or false ) | false |
|||
Fuzzy Search | datatables-fuzzysearch | datatables_fuzzysearch_threshold | float | 0.5 |
|||
Fuzzy Search | datatables-fuzzysearch | datatables_fuzzysearch_togglesmart | boolean (true or false ) | true |
|||
Fuzzy Search | datatables-fuzzysearch | datatables_fuzzysearch_rankcolumn | string | "" (empty string) |
On this page