BUG Remove "empty" keywords when building search SQL

This commit is contained in:
Sean Harvey 2012-12-19 11:19:21 +13:00
parent d17ae37411
commit f34996ae1c

View File

@ -1451,8 +1451,13 @@ class MSSQLDatabase extends SS_Database {
// Remove stopwords, concat with ANDs
$keywords = explode(' ', $keywords);
$keywords = self::removeStopwords($keywords);
$keywords = implode(' AND ', $keywords);
// remove any empty values from the array
foreach($keywords as $i => $word) {
if(!strlen($word)) unset($keywords[$i]);
}
$keywords = implode(' AND ', $keywords);
if (!$keywords || trim($keywords)=='') return null;
if ($fields) $fieldNames = '"' . implode('", "', $fields) . '"';