msaari / relevanssi

Relevanssi, a WordPress plugin to improve the search
GNU General Public License v3.0
49 stars 21 forks source link

add basic Chinese character search support #24

Closed asakous closed 3 years ago

asakous commented 3 years ago

If site already installed phpjieba (a Chineses tokenizer extension) then use is as tokenizer.

msaari commented 3 years ago

This modification is not necessary, as you can use the Jieba tokenizer on the relevanssi_remove_punctuation filter hook:

add_filter( 'relevanssi_remove_punctuation', 'rlv_use_jieba' );
function rlv_use_jieba( $string ) {
    $string = jieba( $string, 1,1500 );
    $string = @implode( ' ', $string );
    return $string;
}

I'm not very keen to hardcode parameters to Relevanssi that I do not understand and that may not work in every occasion. With the filter function, you can use the parameters you see fit for your case.

msaari commented 3 years ago

I've updated the Relevanssi language instructions and will include the Taiwanese stop words. Thanks!