• Resolved WP3DW

    (@wp3dw)


    Hi,

    I am working on a website that uses Toolset search in combination with Relevanssi for search in the custom fields also.

    The search entered is “C#”. However if I activate toolset to search in post title, post body and in the custom fields then the posts with C# do not get found.
    If i switch back to only search in post title and post body (so the search is by Toolset and not by Relevanssi) then the posts do get found.
    This is confirmed by Toolset support and they suggested to contact your support to see if it’s possible to get special characters indexed by Relevanssi, in this case the “#”.
    See Toolset thread here

    I could not find a solution to do so I hope you can assist?

    Kind regards,

    • This topic was modified 3 years, 11 months ago by WP3DW.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Yes, Relevanssi will replace “#” with a space, and even if it didn’t, “C#” is shorter than the default minimum word length of 3.

    Adjust the minimum word length to 2 in the Relevanssi advanced indexing settings and dd this to your theme functions.php:

    add_filter('relevanssi_remove_punctuation', 'savepound_1', 9);
    function savepound_1($a) {
        $a = str_replace('#', 'POUNDSYMBOL', $a);
        return $a;
    }
     
    add_filter('relevanssi_remove_punctuation', 'savepound_2', 11);
    function savepound_2($a) {
        $a = str_replace('POUNDSYMBOL', '#', $a);
        return $a;
    }

    Then rebuild the index, and searching for “C#” should now be possible.

    Thread Starter WP3DW

    (@wp3dw)

    Hi Mikko,

    Thanks for your very quick response and solution! Works perfect now.
    I will update my support request at Toolset also.

    Thanks again and also for your plugin!

    Kind regards.

    Wim

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘hashtag character not indexed’ is closed to new replies.