The method is the same as with phpjieba. Based on the Limelight documentation on GitHub, I’m guessing this:
add_filter( 'relevanssi_remove_punctuation', function( $string ) {
$limelight = new Limelight();
$results = $limelight->parse( $string );
$words = array();
foreach ( $results as $word ) {
$words[] = $word->word();
}
if ( count( $words ) > 0 ) {
$string = implode( ' ', $words );
}
return $string;
} );
I can’t provide simple instructions on getting the Limelight set up so that you can call it like that, though; I have never done that myself.
Thank you for your response. It’s too difficult for me, so I’ll give up.
(searching for ‘ana’ will match ‘anaconda’ or ‘banana’, but not ‘banal’)
Is there any other way to include ‘banal’ in the search results?
Thank you in advance.
Yes. You can add this to your site:
add_filter( 'relevanssi_fuzzy_query', 'rlv_partial_inside_words' );
function rlv_partial_inside_words( $query ) {
return "(relevanssi.term LIKE '%#term#%')";
}
This will make Relevanssi match inside works, which makes the Japanese search somewhat work, but the result weights will be essentially random as Relevanssi can’t weight the results properly when it doesn’t know where the words are. So you can do this, and you can get results out of it, but they will not be good results.
I got the results I was looking for! thank you!