Now both empty search strings and 1 letter search strings works fine in
the glossary. Terms are hilighted properly (but 1 letter terms, because it's a hilight limitation). Bug 4274. (http://moodle.org/bugs/bug.php?op=show&bugid=4274)
This commit is contained in:
@@ -188,9 +188,7 @@
|
||||
$searchterms = explode(" ",$hook);
|
||||
|
||||
foreach ($searchterms as $searchterm) {
|
||||
if (strlen($searchterm) < 2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($conceptsearch) {
|
||||
$conceptsearch .= " AND ";
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user