Index: branches/5.1.x/core/units/helpers/search_helper.php =================================================================== diff -u -N -r12657 -r13086 --- branches/5.1.x/core/units/helpers/search_helper.php (.../search_helper.php) (revision 12657) +++ branches/5.1.x/core/units/helpers/search_helper.php (.../search_helper.php) (revision 13086) @@ -1,6 +1,6 @@ splitKeyword($keyword); + $keywords = $this->splitKeyword( $this->transformWildcards($keyword) ); $normal_conditions = Array(); $plus_conditions = Array(); @@ -71,37 +82,36 @@ switch ($sign) { case '+': - $plus_conditions[] = implode(' LIKE "%'.$keyword.'%" OR ', $fields).' LIKE "%'.$keyword.'%"'; + $plus_conditions[] = implode(" LIKE '%" . $keyword . "%' OR ", $fields) . " LIKE '%" . $keyword . "%'"; break; case '-': foreach ($fields as $field) { - $condition[] = $field.' NOT LIKE "%'.$keyword.'%" OR '.$field.' IS NULL'; + $condition[] = $field . " NOT LIKE '%" . $keyword . "%' OR " . $field . ' IS NULL'; } - $minus_conditions[] = '('.implode(') AND (', $condition).')'; + $minus_conditions[] = '(' . implode(') AND (', $condition) . ')'; break; case '': - $keyword = str_replace('"', '\"', $keyword); - $normal_conditions[] = implode(' LIKE "%'.$keyword.'%" OR ', $fields).' LIKE "%'.$keyword.'%"'; + $normal_conditions[] = implode(" LIKE '%" . $keyword . "%' OR ", $fields) . " LIKE '%" . $keyword . "%'"; break; } } // building where clause if ($normal_conditions) { - $where_clause = '('.implode(') OR (', $normal_conditions).')'; + $where_clause = '(' . implode(') OR (', $normal_conditions) . ')'; } else { $where_clause = '1'; } if ($plus_conditions) { - $where_clause = '('.$where_clause.') AND ('.implode(') AND (', $plus_conditions).')'; + $where_clause = '(' . $where_clause . ') AND (' . implode(') AND (', $plus_conditions) . ')'; } if ($minus_conditions) { - $where_clause = '('.$where_clause.') AND ('.implode(') AND (', $minus_conditions).')'; + $where_clause = '(' . $where_clause . ') AND (' . implode(') AND (', $minus_conditions) . ')'; } return $where_clause; @@ -176,7 +186,6 @@ // process search keyword $search_keyword = $this->Application->GetVar( $event->getPrefixSpecial(true).'_search_keyword'); $this->Application->StoreVar( $event->getPrefixSpecial().'_search_keyword', $search_keyword); - $search_keyword = str_replace('*', '%', $search_keyword); $custom_filter = $this->processCustomFilters($event); @@ -254,6 +263,7 @@ $match_to = mb_strtolower($use_phrases ? $this->Application->Phrase($val) : $val); foreach ($search_keywords as $keyword => $sign) { + // doesn't support wildcards if (strpos($match_to, mb_strtolower($keyword)) === false) { if ($sign == '+') { $filter_value = $table_name.'`'.$field_name.'` = NULL';