• Hi. There is some maybe little confusing question but I will try to ask it as simple as possible. So im trying to make refferences between letters. In armenian ? is same as letter a, ? is b , ? is c and so on, Is there any way to somehow syncronise or reffer that letters between so when somedy write for example armenian word ???, which is with english letters is bac the results show on as same for both words?

    With best regards.

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

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

    (@msaari)

    A straightforward solution would be to normalize all text in your database to Latin letters. Add this to your theme functions.php:

    add_filter( 'relevanssi_punctuation_filter', function( $replacements ) {
        $replacements['?'] = 'a';
        $replacements['?'] = 'b';
        $replacements['?'] = 'g';
        $replacements['?'] = 'd';
        $replacements['?'] = 'e';
        $replacements['?'] = 'z';
        $replacements['?'] = 'e';
        $replacements['?'] = 'y';
        $replacements['?'] = 't';
        $replacements['?'] = 'zh';
        $replacements['?'] = 'i';
        $replacements['?'] = 'l';
        $replacements['?'] = 'kh';
        $replacements['?'] = 'ts';
        $replacements['?'] = 'k';
        $replacements['?'] = 'h';
        $replacements['?'] = 'dz';
        $replacements['?'] = 'gh';
        $replacements['?'] = 'ch';
        $replacements['?'] = 'm';
        $replacements['?'] = 'y';
        $replacements['?'] = 'n';
        $replacements['?'] = 'sh';
        $replacements['?'] = 'o';
        $replacements['?'] = 'ch';
        $replacements['?'] = 'p';
        $replacements['?'] = 'j';
        $replacements['?'] = 'r';
        $replacements['?'] = 's';
        $replacements['?'] = 'v';
        $replacements['?'] = 't';
        $replacements['?'] = 'r';
        $replacements['?'] = 'ts';
        $replacements['?'] = 'v';
        $replacements['?'] = 'p';
        $replacements['?'] = 'q';
        $replacements['?'] = 'ev';
        $replacements['?'] = 'o';
        $replacements['?'] = 'f';
        return $replacements;
    } );

    All Armenian text will be indexed using the Latin alphabet when you rebuild the index. This conversion is also applied to searches.

    Thread Starter xCelestialx

    (@samvel45)

    Thank you bro, I was out of projects for a while so just seen and tested your answer and it works well except one important thing. After I reindex the search with active code for example if I write shoe and I have 16 shoes it shows only one result so adding this snippet makes some errors on indexing. Can you tell me what can I do?

    Plugin Author Mikko Saari

    (@msaari)

    Well, what happens? If you look at the posts with the Relevanssi debugger, does the indexed content seem correct?

    Thread Starter xCelestialx

    (@samvel45)

    Oh i see that it doesnt make refference but it replace letters so in index table title “????????? ?????” became “tghamardov ?odhik” so now If i write with english letters it will find it and with armenian will not

    Plugin Author Mikko Saari

    (@msaari)

    Yes, correct, that’s how it’s supposed to work. However, it should do the same conversion to the user-entered search terms as well. Is that not happening?

    Thread Starter xCelestialx

    (@samvel45)

    Yeah its not happening actually when I enable script of letter refference its not making refference but actually replace letters in database so because of that original language and even translated cant find actual product.

    Plugin Author Mikko Saari

    (@msaari)

    Yes, that’s how it should work; that’s what normalization means. What is not working is doing the same replacement to the search terms; that should also happen, as the search terms go through the same process.

    Another approach is to use the relevanssi_indexing_tokens filter to add the transcribed versions of the words to the index. You could convert Armenian words to the Latin alphabet and also index those tokens. That way you would get both versions in the index.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Create refferences between letters of different languages’ is closed to new replies.