Index: branches/5.2.x/core/units/categories/categories_event_handler.php =================================================================== diff -u -N -r16027 -r16148 --- branches/5.2.x/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 16027) +++ branches/5.2.x/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 16148) @@ -1,6 +1,6 @@ :]]", '.$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)'; } }