- Usage
- Use for Unlimited Sites (GPL)
- Update Notice
- If we have missed to Update this Item let us know to update ASAP
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)
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)
searchwp_fuzzy_digit_threshold
Set the maximum percentage of digits in search term to perform spell checking (default is 10)
searchwp_fuzzy_min_length
Set the minimum word length to include in fuzzy matches (default is 5)
Code:
<?php
function my_fuzzy_word_length()
{
return 5;
}
add_filter( 'searchwp_fuzzy_min_length', 'my_fuzzy_word_length' );
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)
Code:
<?php
function my_fuzzy_threshold()
{
return 85;
}
add_filter( 'searchwp_fuzzy_threshold', 'my_fuzzy_threshold' );
searchwp_fuzzy_digit_threshold
Set the maximum percentage of digits in search term to perform spell checking (default is 10)
Code:
<?php
function myChangeDigitThreshold()
{
return 15; // 15% maximum threshold
}
add_filter( 'searchwp_fuzzy_digit_threshold', 'myChangeDigitThreshold' );