<h1>DataTables example <span>Fuzzy Searching</span></h1>
<divclass="info">
<p>Fuzzy searching is used in search engines and databases to perform searches that will match results that are not necessarily exactly the same as the search
term. This allows spelling mistakes and typos to be accounted for. It also allows small changes in dialect not to affect search results. A commonly used example is
for surname searching. "Smith" and "Smythe" are pronounced the same way, but using conventional searching typing "Smith" would not return "Smythe".</p>
<p>This plug-in adds fuzzy search functionality to DataTables. It does this through a combination of exact matching and the <ahref=
"https://github.com/tad-lispy/node-damerau-levenshtein">Damerau-Levenshtein algorithm</a>. There are three initialisation options that are associated with this
plugin.</p>
<ulclass="markdown">
<li><code>fuzzySearch.toggleSmart</code> allows the searching to be changed from exact matching to fuzzy searching.</li>
<li><code>fuzzySearch.rankColumn</code> allows the % match to be set in a column within the datatable. Some examples of use cases could be to display the value
to the user, or to hide the column and order based on it - as a search engine would.</li>
<li><code>fuzzySearch.threshold</code> allows the value of similarity that is required from the Damerau-Levenshtein function to display the row to be
changed.</li>
</ul>
<p>This example shows how the API methods can be used to work with fuzzy searching. There are 4 buttons below which implement the following actions</p>
<ulclass="markdown">
<li><code>.search(value)</code>This button takes the value from the input element to the left of the buttons and passes it into the <code>.search()</code>
api method. Doing this should update the value in the tables input element, but not yet update the tables records. If instead an undefined value were to be
passed in this method would act as a getter and retrieve the most recent search value.</li>
<li><code>.search("")</code>This button again calls the <code>.search()</code> api method, this time with an empty string to clear that value that it stores.
Doing this should update the value in the tables input element, but not yet update the tables records.</li>
<li><code>.search.fuzzy(value)</code>This button takes the value from the input element to the left of the buttons and passes it into the <code>.search.fuzzy()</code>
api method. Doing this should update the value in the tables input element, but not yet update the tables records. If instead an undefined value were to be
passed in this method would act as a getter and retrieve the most recent fuzzy search value.</li>
<li><code>.search.fuzzy("")</code>This button again calls the <code>.search.fuzzy()</code> api method, this time with an empty string to clear that value that
it stores. Doing this should update the value in the tables input element, but not yet update the tables records.</li>
<li><code>.draw()</code>This button calls the <code>.draw()</code> api method. Doing this will update the table to display the values that have been returned
based on the calls to the above api methods. If a value has been set for both exact and fuzzy searching then both must approve a row for it to be displayed.
Clearing one of these values and drawing again will cause the other to be the sole filter that is applied. If the tables UI is used at any point then the
exact search is discarded and fuzzy search takes command</li>
<p>The Javascript shown below is used to initialise the table shown in this example:</p><codeclass="multiline language-js">$(document).ready(function() {