From: stronk7 Date: Fri, 9 Mar 2007 20:58:01 +0000 (+0000) Subject: Prevent some languages without word whitespace separators to use X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=375450a4e72a925af855b915c405990902d8d4b2;p=moodle.git Prevent some languages without word whitespace separators to use documental searches over MySQL. Merged from MOODLE_18_STABLE --- diff --git a/lib/searchlib.php b/lib/searchlib.php index 964e745ae5..ef86ad0d8c 100644 --- a/lib/searchlib.php +++ b/lib/searchlib.php @@ -320,6 +320,16 @@ function search_generate_text_SQL($parsetree, $datafield, $metafield, $mainidfie $userfirstnamefield, $userlastnamefield, $timefield, $instancefield); } +/// Some languages don't have "word separators" and MySQL FULLTEXT doesn't perform well with them, so +/// switch to standard SQL search generation + if ($CFG->dbfamily == 'mysql') { + $nonseparatedlangs = array('ja_utf8', 'th_utf8', 'zh_cn_utf8', 'zh_tw_utf8'); + if (in_array(current_language(), $nonseparatedlangs)) { + return search_generate_SQL($parsetree, $datafield, $metafield, $mainidfield, $useridfield, + $userfirstnamefield, $userlastnamefield, $timefield, $instancefield); + } + } + /// Here we'll acumulate non-textual tokens $non_text_tokens = array();