• Resolved meme2meme

    (@meme2meme)


    I use Relevancessi in WordPress and would like to implement limelight to support Japanese word searches.

    However, Github only describes how to install it, and does not specifically describe how to use it with WordPress.

    How can I do Japanese word searches in WordPress?

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

    (@msaari)

    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.

    Thread Starter meme2meme

    (@meme2meme)

    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.

    Plugin Author Mikko Saari

    (@msaari)

    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.

    Thread Starter meme2meme

    (@meme2meme)

    I got the results I was looking for! thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘I want to install Limelight on WordPress to support Japanese language search.’ is closed to new replies.