• Resolved jdjtex

    (@jdjtex)


    Hello. I have reduced the number of letters to make a word to be indexed in advanced settings. I set periods to be kept. Ive reindexed multiple times. “am” will be found, but not “a.m.” which I very much need. Ive run out of ideas. I tried to just have periods replaced:

    add_filter(‘relevanssi_remove_punctuation’, ‘rlv_keep_brackets_1’, 9);
    function rlv_keep_brackets_1($a) {
    $a = str_replace( ‘.’, ‘period’, $a );
    return $a;
    }

    add_filter(‘relevanssi_remove_punctuation’, ‘rlv_keep_brackets_2’, 11);
    function rlv_keep_brackets_2($a) {
    $a = str_replace(‘period’, ‘,’, $a);
    return $a;
    but i dont know much about code. Please help and thank you in advance.

    The page I need help with: [log in to see the link]

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

    (@msaari)

    You’re pretty close. Your second function replaces “period” with a comma. This should work:

    add_filter( 'relevanssi_remove_punctuation', 'rlv_keep_brackets_1', 9 );
    function rlv_keep_brackets_1( $a ) {
        $a = str_replace( '.', 'period', $a );
        return $a;
    }
    
    add_filter( 'relevanssi_remove_punctuation', 'rlv_keep_brackets_2', 11 );
    function rlv_keep_brackets_2( $a ) {
        $a = str_replace( 'period', '.', $a );
        return $a;
    }

    Add these and rebuild the index, and it should work.

    Thread Starter jdjtex

    (@jdjtex)

    I have replaced PHP code with yours and still not getting desired effect. Do i leave the decimals set to keep and search string length to 2? Because thats what i did and unfortunately it did not work.

    Plugin Author Mikko Saari

    (@msaari)

    The decimal separator setting doesn’t matter because these are not decimals. Minimum word length doesn’t matter, either, as when you keep the periods, “a.m.” is four characters long.

    Can you please enable the debugging mode in the Relevanssi settings debugging tab and point me to a post where “a.m.” appears?

    Thread Starter jdjtex

    (@jdjtex)

    I reindexed (i may have forgotten last time) and it works now!! Thank you you just saved me so much headache!!! CHeers!!!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Unable to search for “a.m.”’ is closed to new replies.