diff --git a/mod/glossary/sql.php b/mod/glossary/sql.php index f4d1a76f5cc..b03263cccc1 100644 --- a/mod/glossary/sql.php +++ b/mod/glossary/sql.php @@ -188,9 +188,7 @@ $searchterms = explode(" ",$hook); foreach ($searchterms as $searchterm) { - if (strlen($searchterm) < 2) { - continue; - } + if ($conceptsearch) { $conceptsearch .= " AND "; } diff --git a/mod/glossary/view.php b/mod/glossary/view.php index 6476bc4d91a..a72092ae6bb 100644 --- a/mod/glossary/view.php +++ b/mod/glossary/view.php @@ -124,15 +124,9 @@ case 'search': /// looking for terms containing certain word(s) $tab = GLOSSARY_STANDARD_VIEW; - $searchterms = trim(strip_tags($hook)); + //Clean a bit the search string + $hook = trim(strip_tags($hook)); - $searchterms = explode(' ', $searchterms); // Search for words independently - foreach ($searchterms as $key => $searchterm) { - if (strlen($searchterm) < 2) { - unset($searchterms[$key]); - } - } - $hook = trim(implode(' ', $searchterms)); break; case 'entry': /// Looking for a certain entry id @@ -369,6 +363,10 @@ } else { $searchterms[$key] = preg_replace('/^\+/','',$searchterm); } + //Avoid highlight of <2 len strings. It's a well known hilight limitation. + if (strlen($searchterm) < 2) { + unset($searchterms[$key]); + } } $strippedsearch = implode(' ', $searchterms); // Rebuild the string $entry->highlight = $strippedsearch;