diff --git a/mod/glossary/sql.php b/mod/glossary/sql.php index 0fa0b6e809a..a9d3f150149 100644 --- a/mod/glossary/sql.php +++ b/mod/glossary/sql.php @@ -152,15 +152,6 @@ //$params = array(); $i = 0; - if (empty($fullsearch)) { - // With fullsearch disabled, look only within concepts and aliases. - $concat = $DB->sql_concat('ge.concept', "' '", "COALESCE(al.alias, :emptychar)"); - } else { - // With fullsearch enabled, look also within definitions. - $concat = $DB->sql_concat('ge.concept', "' '", 'ge.definition', "' '", "COALESCE(al.alias, :emptychar)"); - } - $params['emptychar'] = ''; - $searchterms = explode(" ",$hook); foreach ($searchterms as $searchterm) { @@ -169,8 +160,17 @@ $NOT = false; /// Initially we aren't going to perform NOT LIKE searches, only MSSQL and Oracle /// will use it to simulate the "-" operator with LIKE clause - /// Under Oracle and MSSQL, trim the + and - operators and perform - /// simpler LIKE (or NOT LIKE) queries + if (empty($fullsearch)) { + // With fullsearch disabled, look only within concepts and aliases. + $concat = $DB->sql_concat('ge.concept', "' '", "COALESCE(al.alias, :emptychar".$i.")"); + } else { + // With fullsearch enabled, look also within definitions. + $concat = $DB->sql_concat('ge.concept', "' '", 'ge.definition', "' '", "COALESCE(al.alias, :emptychar".$i.")"); + } + $params['emptychar'.$i] = ''; + + /// Under Oracle and MSSQL, trim the + and - operators and perform + /// simpler LIKE (or NOT LIKE) queries if (!$DB->sql_regex_supported()) { if (substr($searchterm, 0, 1) == '-') { $NOT = true;