• Resolved cheonmu

    (@cheonmu)


    hello. First of all, thank you so much for developing the plugin.

    I have hundreds of posts written in Korean and I recently installed Relevanssi and did some tests.

    The search function works well, but there seems to be a problem that it doesn’t recognize titles and therefore doesn’t weight them.

    For example, I have two posts with titles that exactly match the keyword “currency exchange in Vietnam”.

    However, Relevanssi’s search results prioritize the “currency exchange in Vietnam” keyword embedded in the contents of completely unrelated posts over the titles.

    This is despite the fact that we set the weights as follows

    Element Weight
    Content 1
    Titles 10

    Relevanssi seems to recognize the body (content), so it’s looks like not a language issue, but I can’t find the cause.

    When I check with the “What does the post look like in the database tool”, the title is not included.

    Could you tell me how to solve this problem?

    I have tested using the Twenty Twenty-Four theme on my Staggering site after deactivating all plugins.

    Thank you.

    • This topic was modified 1 year, 2 months ago by cheonmu.
    • This topic was modified 1 year, 2 months ago by cheonmu.
    • This topic was modified 1 year, 2 months ago by cheonmu.

    The page I need help with: [log in to see the link]

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

    (@msaari)

    The language isn’t a problem; Korean is one of the Asian languages Relevanssi can work with, because Korean uses spaces between the words.

    The title shouldn’t appear in the “What does the post look like in the database”; that only shows the post content. What if you use the first debugging checker? The title should appear there.

    Thread Starter cheonmu

    (@cheonmu)

    Hi @msaari

    I found the cause. The problem was that if a word had a postposition, Relevanssi recognized it as a separate word.

    The word “?” in “??? ???” and “??? ??” is just a postposition, so they are the same word.

    But Relevancy understands the two words differently. To solve this, I looked at the French plural filter and changed the code to include frequently used postpositions in Korean.

    most of Korean words start with a minimum length of 2, so i replace Minimum word length as 2 and use the code, i can get very accurate results and all features of Relevanssi will work perfectly.

    add_filter( 'relevanssi_stemmer', 'relevanssi_korean_plural_stemmer' );
    function relevanssi_korean_plural_stemmer( $term ) {
        $len  = strlen( $term );
        $end1 = substr( $term, -1, 1 );
        if ( '?' === $end1 && $len > 2 ) {
            $term = substr( $term, 0, -1 );
        }
        elseif ( '?' === $end1 && $len > 2 ) {
            $term = substr( $term, 0, -1 );
        }
        elseif ( '?' === $end1 && $len > 2 ) {
            $term = substr( $term, 0, -1 );
        }
        elseif ( '?' === $end1 && $len > 2 ) {
            $term = substr( $term, 0, -1 );
        }
        elseif ( '?' === $end1 && $len > 2) {
            $term = substr( $term, 0, -1 );
        }
        elseif ( '?' === $end1 && $len > 2) {
            $term = substr( $term, 0, -1 );
        }
        elseif ( '?' === $end1 && $len > 2) {
            $term = substr( $term, 0, -1 );
        }
        elseif ( '?' === $end1 && $len > 2) {
            $term = substr( $term, 0, -1 );
        }
        elseif ( '?' === $end1 && $len > 2) {
            $term = substr( $term, 0, -1 );
        }
        elseif ( '?' === $end1 && $len > 2) {
            $term = substr( $term, 0, -1 );
        }
        elseif ( '??' === $end1 && $len > 2) {
            $term = substr( $term, 0, -1 );
        }
        elseif ( '?' === $end1 && $len > 2) {
            $term = substr( $term, 0, -1 );
        }
        elseif ( '?' === $end1 && $len > 2) {
            $term = substr( $term, 0, -1 );
        }
        elseif ( '??' === $end1 && $len > 2) {
            $term = substr( $term, 0, -1 );
        }
        elseif ( '?' === $end1 && $len > 2) {
            $term = substr( $term, 0, -1 );
        }
        return $term;
    }
    

    Thank you!

    • This reply was modified 1 year, 2 months ago by cheonmu.
    Plugin Author Mikko Saari

    (@msaari)

    Very good. If you don’t mind, I’d like to post your code to the Relevanssi knowledge base so other Korean users can benefit from this. There are often simple tricks like this that help the search, but when you don’t know the language at all, it’s impossible to know these.

    Thread Starter cheonmu

    (@cheonmu)

    Yes. Please! I hope this will be helpful to many Korean users.

    As a point, please make sure to set the minimum word length to 2.

    Thank you ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Relevanssi doesn’t seem to recognize the title.’ is closed to new replies.