/** Add the sql to perform a search.
*
* @param Gdn_SQLDriver $Sql
* @param string $Columns a comma seperated list of columns to search on.
*/
public function addMatchSql($Sql, $Columns, $LikeRelavenceColumn = '')
{
if ($this->_SearchMode == 'like') {
if ($LikeRelavenceColumn) {
$Sql->select($LikeRelavenceColumn, '', 'Relavence');
} else {
$Sql->select(1, '', 'Relavence');
}
$Sql->beginWhereGroup();
$ColumnsArray = explode(',', $Columns);
$First = true;
foreach ($ColumnsArray as $Column) {
$Column = trim($Column);
$Param = $this->Parameter();
if ($First) {
$Sql->where("{$Column} like {$Param}", null, false, false);
$First = false;
} else {
$Sql->orWhere("{$Column} like {$Param}", null, false, false);
}
}
$Sql->endWhereGroup();
} else {
$Boolean = $this->_SearchMode == 'boolean' ? ' in boolean mode' : '';
$Param = $this->Parameter();
$Sql->select($Columns, "match(%s) against({$Param}{$Boolean})", 'Relavence');
$Param = $this->Parameter();
$Sql->where("match({$Columns}) against ({$Param}{$Boolean})", null, false, false);
}
}