Fuzzy Search

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

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 NameLast NameZIPPointsAverage
GloriaSmythe6743940.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 NameLast NameZIPPointsAverageSimilarity
GloriaSmythe6743940.1
GrahamBonner9072740.9
WarrenWheeler9913420.7
ZenaHale1980390.3
JuliaHaupt24116101.0
RachelSmith5895170.3
LionelBarry6503670.5
ZenaMiller1687450.6
DillonBradford9154370.4
HaleyMcleod9932140.1
AbraHouse9953760.1
ArielSmyth5655560.7
RoaryAyers1272030.5
MasonMoller8106230.6
GillianSimon69137100.7
RebekahFisher3257230.7
CameronWalls1878820.2
PhelanMeyer9541360.2
MonaFischer4891290.6
RashadWebb2799340.1
BrandonKinney0098620.2
SachaGould1772280.7
BrendaOsborn5213940.5
SophiaMeier7968830.2
BreeOrr7016090.7
YenBernard9921610.3
LacotaLe64964100.7
NaydaHorton42308100.1
LeeNavarro4891850.4
MargaretAustin2618170.3
BrynneRandolph6852380.9
OlegMayer3224990.4
MarkCooley5492330.2
BrendanSharp4751110.5
HollyCarrillo7168910.3
KelseyMoses2766150.8
GeraldineTyson9804930.6
JasperMaier9232930.5
NobleConley1486980.5
NatalieLuna6663780.7
McKenziePowell8625990.4
TylerDennis1367660.2
VladimirJefferson7856970.3
BrettPena1421810.8
DemetriusKey6798520.4
GwendolynSchmitt9732410.8
MarvinMiddleton1014120.7
NadineWalters2748460.7
ClaireSchmidt5421850.4
JimmyMiller4112360.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:

ModuleSlugConfiguration parameterNameDescriptionTypeDefault value
Fuzzy Searchdatatables-fuzzysearchdatatables_fuzzysearchboolean (true or false)false
Fuzzy Searchdatatables-fuzzysearchdatatables_fuzzysearch_thresholdfloat0.5
Fuzzy Searchdatatables-fuzzysearchdatatables_fuzzysearch_togglesmartboolean (true or false)true
Fuzzy Searchdatatables-fuzzysearchdatatables_fuzzysearch_rankcolumnstring"" (empty string)