Author Topic: How by search to level one letter to another?  (Read 4373 times)

0 Members and 1 Guest are viewing this topic.

Offline Lunat

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
    • В объективе - МИР!
How by search to level one letter to another?
« on: October 21, 2008, 10:13:27 PM »
In Russian there are two letters the difference in which is insignificant ("е" and "ё"). How by search to level one letter to another?
« Last Edit: October 21, 2008, 10:25:28 PM by Lunat »

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: How by search to level one letter to another?
« Reply #1 on: October 21, 2008, 10:54:38 PM »
... mmm ...
... if I understand you not quite right ... then sorry ...
... but the 4images-search is a word-search not a letter-search ...
... and by default you need 3 letters as a minimum for your search ...
... so the search find only the words with the right letter "e" or  "ё" ...
... so, where is the problem ... ?
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline Lunat

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
    • В объективе - МИР!
Re: How by search to level one letter to another?
« Reply #2 on: October 21, 2008, 11:00:31 PM »
Problem in that letters mean one and too! And if I enter "елка" 4images will not find to me "ёлка".
PS. "ёлка" means "fur-tree"  :D

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: How by search to level one letter to another?
« Reply #3 on: October 21, 2008, 11:26:08 PM »
... but this is not a problem with 4images and Russian language ...
... I think,  the problem ist between keyboard and chair ...
... if I enter in German language "Ara" (engl. a bird) 4images will not find "Ära" (engl. era) ...
... sorry, so I can't see any 4images problem ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: How by search to level one letter to another?
« Reply #4 on: October 22, 2008, 04:11:02 AM »
Open includes/search_utils.php
Find:
function convert_special($text) {
  return 
strtr(
    
$text,
    array(

Insert BELOW:
Code: [Select]
//russian Windows-1251
      "А" => "а",
      "Б" => "б",
      "В" => "в",
      "Г" => "г",
      "Д" => "д",
      "Е" => "е",
      "Ё" => "е",
      "ё" => "е",
      "Ж" => "ж",
      "З" => "з",
      "И" => "и",
      "Й" => "й",
      "К" => "к",
      "Л" => "л",
      "М" => "м",
      "Н" => "н",
      "О" => "о",
      "П" => "п",
      "Р" => "р",
      "С" => "с",
      "Т" => "т",
      "У" => "ы",
      "Ф" => "ф",
      "Х" => "х",
      "Ц" => "ц",
      "Ч" => "ч",
      "Ш" => "ш",
      "Щ" => "щ",
      "Ъ" => "ъ",
      "Ы" => "ы",
      "Ь" => "ь",
      "Э" => "э",
      "Ю" => "ю",
      "Я" => "я",
And this: (I had to split into two parts, because this forum messes up the characters)

//russian UTF8 encoded alphabet
      
"А" => "а",
      
"Б" => "б",
      
"В" => "в",
      
"Г" => "г",
      
"Д" => "д",
      
"Е" => "е"//russ Je => e
      
"Ё" => "е"//russ Jo => e
      
"ё" => "е"//russ jo => e
      
"Ж" => "ж",
      
"З" => "з",
      
"И" => "и",
      
"Й" => "й",
      
"К" => "к",
      
"Л" => "л",
      
"М" => "м",
      
"Н" => "н",
      
"О" => "о",
      
"П" => "п",
      
"Р" => "р",
      
"С" => "с",
      
"Т" => "т",
      
"У" => "ы",
      
"Ф" => "ф",
      
"Х" => "х",
      
"Ц" => "ц",
      
"Ч" => "ч",
      
"Ш" => "ш",
      
"Щ" => "щ",
      
"Ъ" => "ъ",
      
"Ы" => "ы",
      
"Ь" => "ь",
      
"Э" => "э",
      
"Ю" => "ю",
      
"Я" => "я",

(I've attached modified search_utils.php file just in case)
This should do the trick with newly added images. For the already added images you might want run the [Plugin] Rebuild search index.
These changes also fix problem with capital russian letters - PHP doesn't change case for russian letters unless server's locale is set to CP1251 or KOI8, so searching for "ёлка" will not find image with name "Ёлка".



@mawenzi:
in russian if a word has a letter "ё" it is grammatically correct write that word with such letter, however it is acceptable replace that letter with letter "е" without loosing the meaning.
Even though  these two letters pronounce differently ("e" = "je" and "ё" = "jo"), if "e" used in such word we still pronounce it as if it was "ё" ("елка" and "ёлка" pronounce the same and have same meaning). So for search engines it is a good thing see no difference between letter "e" and "ё".

... if I enter in German language "Ara" (engl. a bird) 4images will not find "Ära" (engl. era) ...
This is correct simply because by default 4images supports deutsch:
Code: [Select]
function convert_special($text) {
  return strtr(
    $text,
    array(
      "Ä" => "AE",
      "Ö" => "OE",
      "Ü" => "UE",
      "ä" => "ae",
      "ö" => "oe",
      "ü" => "ue",
      "ß" => "ss"
    )
  );
}
in search_utils.php

P.S.
"ёлка" = "Christmas tree" ;)
« Last Edit: October 22, 2008, 07:23:01 AM by V@no »
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)