mirror of
https://github.com/silverstripe/silverstripe-mssql
synced 2024-10-22 08:05:53 +02:00
BUG Remove "empty" keywords when building search SQL
This commit is contained in:
parent
d17ae37411
commit
f34996ae1c
@ -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) . '"';
|
||||
|
Loading…
Reference in New Issue
Block a user