Support » Plugin: Relevanssi - A Better Search » Fuzzy Search Option Not Honored

  • Resolved Jackson


    For the option ‘When to use fuzzy matching?’, I have ‘Don’t use fuzzy search’ selected.

    However I am still getting fuzzy results when searching.

    A search for “L-1-803” is matching items containing L-1-803-HO

    Is this the intended behavior?

    Thanks for a great plugin.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Mikko Saari


    Relevanssi sees both “L-1-803” and “L-1-803-HO” as “803”, after punctuation and too short words are removed.

    Looks like you might want to modify the punctuation removal so that it keeps the hyphens.

    add_filter('relevanssi_remove_punctuation', 'fixhyphens1', 9);
    function fixhyphens1($a) {
       $a = str_replace('-', 'HYPHENHYPHEN', $a);
       return $a;
    add_filter('relevanssi_remove_punctuation', 'fixhyphens2', 11);
    function fixhyphens2($a) {
       $a = str_replace('HYPHENHYPHEN', '-', $a);
       return $a;

    Add this to your functions.php and reindex the database, and it’ll work better.

    Thanks so much Mikko, that worked perfectly! I appreciate the response.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Fuzzy Search Option Not Honored’ is closed to new replies.