WordPress.org

Ready to get started?Download WordPress

Forums

Relevanssi - A Better Search
[resolved] Fuzzy Search Option Not Honored (3 posts)

  1. Jackson
    Member
    Posted 1 year ago #

    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.

    http://wordpress.org/extend/plugins/relevanssi/

  2. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  3. Jackson
    Member
    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.