From 81b874d4066e69dd246a01044e911a15fa10e335 Mon Sep 17 00:00:00 2001 From: Paul 'flowerysong' Arthur Date: Sat, 20 Mar 2010 08:02:11 +0000 Subject: Make keyword search *really* play nice with others, by interacting with the designated operator as expected. --- lib/search.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/search.php b/lib/search.php index 37f597fd..199ce5c1 100644 --- a/lib/search.php +++ b/lib/search.php @@ -125,13 +125,14 @@ function search_song($data,$operator,$method,$limit) { if (!(strpos($value, '-'))) // if we want a fuzzier search $additional_soundex = true; - $where_sql = " MATCH (`artist2`.`name`, `album2`.`name`, `song`.`title`) AGAINST ('$value' IN BOOLEAN MODE)"; + $where_sql = "( MATCH (`artist2`.`name`, `album2`.`name`, `song`.`title`) AGAINST ('$value' IN BOOLEAN MODE)"; if ($additional_soundex) { $where_sql.= " OR `artist2`.`name` SOUNDS LIKE '$value'"; $where_sql.= " OR `album2`.`name` SOUNDS LIKE '$value'"; - $where_sql.= " OR `song`.`title` SOUNDS LIKE '$value' $operator"; + $where_sql.= " OR `song`.`title` SOUNDS LIKE '$value' "; } + $where_sql .= ") $operator"; $table_sql = " LEFT JOIN `album` as `album2` ON `song`.`album`=`album2`.`id`"; $table_sql.= " LEFT JOIN `artist` AS `artist2` ON `song`.`artist`=`artist2`.`id`"; -- cgit