mirror of
https://github.com/silverstripe/silverstripe-mssql
synced 2024-10-22 08:05:53 +02:00
BUGFIX If full text not enabled, return empty DataObjectSet in MSSQLDatabase::searchEngine() instead of null (undefined variable)
This commit is contained in:
parent
3e04b42048
commit
e4fe94aae3
@ -1178,7 +1178,11 @@ class MSSQLDatabase extends SS_Database {
|
||||
* @return object DataObjectSet of result pages
|
||||
*/
|
||||
public function searchEngine($classesToSearch, $keywords, $start, $pageLength, $sortBy = "Relevance DESC", $extraFilter = "", $booleanSearch = false, $alternativeFileFilter = "", $invertedMatch = false) {
|
||||
if($this->fullTextEnabled) {
|
||||
$searchResults = new DataObjectSet();
|
||||
if(!$this->fullTextEnabled) {
|
||||
return $searchResults;
|
||||
}
|
||||
|
||||
$keywords = Convert::raw2sql(trim($keywords));
|
||||
$htmlEntityKeywords = htmlentities($keywords);
|
||||
|
||||
@ -1229,7 +1233,6 @@ class MSSQLDatabase extends SS_Database {
|
||||
$query=implode(' UNION ', $tables);
|
||||
|
||||
$result=DB::query($query);
|
||||
$searchResults=new DataObjectSet();
|
||||
|
||||
foreach($result as $row){
|
||||
$row_result=DataObject::get_by_id($row['Source'], $row['ID']);
|
||||
@ -1237,7 +1240,6 @@ class MSSQLDatabase extends SS_Database {
|
||||
}
|
||||
|
||||
$searchResults->setPageLimits($start, $pageLength, $totalCount);
|
||||
}
|
||||
|
||||
return $searchResults;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user