Ignore:
Timestamp:
Nov 28, 2013, 6:24:17 PM (11 years ago)
Author:
maron
Message:
  • Fixed: Double colorization
  • Optimalization: Faster SQL query for search translated names
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/global.php

    r603 r614  
    550550    if ($mode == 2) $where .= ' AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `Sub` WHERE (`Sub`.`Language` <> '.$Config['OriginalLanguage'].') AND (`Sub`.`Entry` = `O`.`Entry`))';
    551551    $where .= ' AND (';
     552    if (array_search('the' , $ArrStr)) $where .= '(`O`.`'.$Column.'` LIKE "The %") OR ';
    552553   
    553554    $SqlOK = false;
     
    555556      for($i = 0; $i < count($ArrStr); $i++)
    556557      {
    557        // if (strpos($ArrStr[$i],"'s") > 0)     $ArrStr[$i] = substr($ArrStr[$i],0,strlen($ArrStr[$i])-2);
    558       //  if (strpos($ArrStr[$i],',') > 0) $ArrStr[$i] = substr($ArrStr[$i],0,strlen($ArrStr[$i])-1);
    559        // if (strpos($ArrStr[$i],'.') > 0) $ArrStr[$i] = substr($ArrStr[$i],0,strlen($ArrStr[$i])-1);
    560        // if (strpos($ArrStr[$i],'!') > 0) $ArrStr[$i] = substr($ArrStr[$i],0,strlen($ArrStr[$i])-1);
    561        // if (strpos($ArrStr[$i],'?') > 0) $ArrStr[$i] = substr($ArrStr[$i],0,strlen($ArrStr[$i])-1);
    562 
    563         if (strlen($ArrStr[$i]) > 4) {
    564           $where .= '(`O`.`'.$Column.'` LIKE "%'.addslashes($ArrStr[$i]).'%") OR ';
     558
     559        //find word only if is 3 characters and more, and if starts by upper char, and search only once
     560        if ((strlen($ArrStr[$i]) > 3) and (ctype_upper(substr($ArrStr[$i],0,1))) and (array_search($ArrStr[$i], $ArrStr) == $i)) {
     561          $where .= '(`O`.`'.$Column.'` LIKE "'.addslashes($ArrStr[$i]).'%") OR ';
    565562          $SqlOK = true;
    566563        }
Note: See TracChangeset for help on using the changeset viewer.