apply_filters( 'relevanssi_stemmer', string $string )
This filter hook runs the stemmers.
Parameters
$string
(string) The string to stem.
More information
Relevanssi Premium adds this filter hook to the tokenizing process. If you want to add a stemmer to Relevanssi, this is the place to do so. This filter hook processes all words that are indexed and used as search terms, and doing the stemming here will make sure everything works correctly.
In the search process, Relevanssi needs to disable the stemmer. Any stemmers should implement the relevanssi_enable_stemmer
and relevanssi_disable_stemmer
actions. To figure out if disabling the stemmer is required, Relevanssi looks if anybody has hooked anything to relevanssi_stemmer
.
If you want to use a stemmer, I would recommend using the Relevanssi Snowball Stemmer. It’s an easy-to-use stemmer that supports multiple languages. For something simple, you can also enable the built-in English suffix stripper in Relevanssi by adding this to your theme functions.php
:
add_filter( 'relevanssi_stemmer', 'relevanssi_simple_english_stemmer' );