• Resolved agamelas

    (@agamelas)


    hi!
    I need to find a search like this “cabo hdmi 7,5” however it does not find a product like “cabo hdmi 7,5mt”
    i have partial words activated but it only finds 7,5mt if I write it all….

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

    (@msaari)

    Relevanssi replaces the comma with a space, leaving you with “7 5”, which is nothing for Relevanssi. If you search for “7,5mt” that becomes “7 5mt”, and that “5mt” is long enough to be considered.

    Add this to your theme functions.php and rebuild the index:

    add_filter('relevanssi_remove_punctuation', 'keep_decimal_separators_1', 9);
    function keep_decimal_separators_1($a) {
        $a = preg_replace('/,(\d)/', 'DECIMALCOMMA\1', $a);
        return $a;
    }
     
    add_filter('relevanssi_remove_punctuation', 'keep_decimal_separators_2', 11);
    function keep_decimal_separators_2($a) {
        $a = str_replace('DECIMALCOMMA', ',', $a);
        return $a;
    }
    Thread Starter agamelas

    (@agamelas)

    Fantastic! Works like a charm!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Refine search’ is closed to new replies.