Index: branches/5.2.x/core/kernel/db/cat_event_handler.php =================================================================== --- branches/5.2.x/core/kernel/db/cat_event_handler.php +++ branches/5.2.x/core/kernel/db/cat_event_handler.php @@ -1318,10 +1318,14 @@ $revelance_parts[] = 'IF('.$field.' REGEXP "[[:<:]]('.$keyword.')[[:>:]]", '.$weight.', 0)'; }*/ + if ( count($positive_words) > 1 ) { + $condition = $field . ' LIKE "%' . implode(' ', $positive_words) . '%"'; + $revelance_parts[] = 'IF(' . $condition . ', ' . $weight_sum . ', 0)'; + } + // search by partial word matches too - $revelance_parts[] = 'IF('.$field.' LIKE "%'.implode(' ', $positive_words).'%", '.$weight_sum.', 0)'; - foreach ($positive_words as $keyword) { - $revelance_parts[] = 'IF('.$field.' LIKE "%'.$keyword.'%", '.$weight.', 0)'; + foreach ( $positive_words as $keyword ) { + $revelance_parts[] = 'IF(' . $field . ' LIKE "%' . $keyword . '%", ' . $weight . ', 0)'; } } Index: branches/5.2.x/core/units/categories/categories_event_handler.php =================================================================== --- branches/5.2.x/core/units/categories/categories_event_handler.php +++ branches/5.2.x/core/units/categories/categories_event_handler.php @@ -2661,10 +2661,14 @@ $revelance_parts[] = 'IF('.$field.' REGEXP "[[:<:]]('.$keyword.')[[:>:]]", '.$weight.', 0)'; }*/ + if ( count($positive_words) > 1 ) { + $condition = $field . ' LIKE "%' . implode(' ', $positive_words) . '%"'; + $revelance_parts[] = 'IF(' . $condition . ', ' . $weight_sum . ', 0)'; + } + // search by partial word matches too - $revelance_parts[] = 'IF('.$field.' LIKE "%'.implode(' ', $positive_words).'%", '.$weight_sum.', 0)'; - foreach ($positive_words as $keyword) { - $revelance_parts[] = 'IF('.$field.' LIKE "%'.$keyword.'%", '.$weight.', 0)'; + foreach ( $positive_words as $keyword ) { + $revelance_parts[] = 'IF(' . $field . ' LIKE "%' . $keyword . '%", ' . $weight . ', 0)'; } }