Fuzzy Matches

Current version: 1.4.3 View Changelog

Download available with active license

Fuzzy matching aims to make SearchWP a bit more lenient with search queries. Use this extension to include search terms that are close in spelling to terms within your index. There are some filters available for this Extension that let you fine-tune how loose the fuzziness is.

searchwp_fuzzy_min_length
Set the minimum word length to include in fuzzy matches (default is 5)

<?php
function my_fuzzy_word_length()
{
return 5;
}
add_filter( 'searchwp_fuzzy_min_length', 'my_fuzzy_word_length' );
view raw gistfile1.php hosted with ❤ by GitHub

searchwp_fuzzy_threshold
Beyond basic fuzzy matching, SearchWP will apply some primitive spell checking to submitted terms. This filter lets you specify what minimum percentage should be used to constitute a valid match. Must be 0 – 100. (default is 80)

<?php
function my_fuzzy_threshold()
{
return 85;
}
add_filter( 'searchwp_fuzzy_threshold', 'my_fuzzy_threshold' );
view raw gistfile1.php hosted with ❤ by GitHub

searchwp_fuzzy_digit_threshold
Set the maximum percentage of digits in search term to perform spell checking (default is 10)

<?php
function myChangeDigitThreshold()
{
return 15; // 15% maximum threshold
}
add_filter( 'searchwp_fuzzy_digit_threshold', 'myChangeDigitThreshold' );
view raw gistfile1.php hosted with ❤ by GitHub

Changelog

1.4.3

  • [New] New filters searchwp_fuzzy_prefix and searchwp_fuzzy_suffix to refine control over partial matches
  • [Update] Updated author
  • [Update] Updated updater

1.4.2

  • [Fix] Fixed a regression that caused Fuzzy Matches' algorithm to fail in some cases

1.4

  • [Improvement] Better term prep
  • [Change] Adjusted priority for better interoperation with other SearchWP Extensions

1.3

  • [Improvement] Support for automatic updates based on your SearchWP license key

1.2

  • [Improvement] Don't find fuzzy matches if the search term exists
  • [Change] Now requires at least SearchWP 2.4.11

1.1

  • [Change] Use searchwp_term_in filter
  • [Change] Now requires at least SearchWP 2.0.3

1.0

  • [Fix] Better match restriction
  • [Fix] Fixed an issue with checking digit ratio

0.3

  • Initial release
Fix Search on Your Site. No Coding Required!

Now you can utilize all of the content that's gone unrecognized by native WordPress search instantly with SearchWP

Get SearchWP