]> git.mjollnir.org Git - moodle.git/commitdiff
Prevent some languages without word whitespace separators to use
authorstronk7 <stronk7>
Fri, 9 Mar 2007 20:58:01 +0000 (20:58 +0000)
committerstronk7 <stronk7>
Fri, 9 Mar 2007 20:58:01 +0000 (20:58 +0000)
documental searches over MySQL.

Merged from MOODLE_18_STABLE

lib/searchlib.php

index 964e745ae57c62f8179cfdf7020deb826445d77b..ef86ad0d8cf5f0af3778d29cc4c1543b915feb0e 100644 (file)
@@ -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();