looks like 0.7.3 added some code in lib/search_engines.php to try a
query with crushed case as well.  Isn't that superfluous now that we
are using a case insensitive collation?

@@ -109,12 +109,25 @@ class MySQLSearch extends SearchEngine

{
    function query($q)
    {
-        if ('identica_people' === $this->table)
-            return $this->target->whereAdd('MATCH(nickname, fullname,
location, bio, homepage) ' .
-                           'against (\''.addslashes($q).'\')');
-        if ('identica_notices' === $this->table)
-            return $this->target->whereAdd('MATCH(content) ' .
-                           'against (\''.addslashes($q).'\')');
+        if ('identica_people' === $this->table) {
+            $this->target->whereAdd('MATCH(nickname, fullname,
location, bio, homepage) ' .
+                                    'AGAINST (\''.addslashes($q).'\'
IN BOOLEAN MODE)');
+            if (strtolower($q) != $q) {
+                $this->target->whereAdd('MATCH(nickname, fullname,
location, bio, homepage) ' .
+                                        'AGAINST
(\''.addslashes(strtolower($q)).'\' IN BOOLEAN MODE)', 'OR');
+            }
+            return true;
+        } else if ('identica_notices' === $this->table) {
+             $this->target->whereAdd('MATCH(content) ' .
+                                     'AGAINST (\''.addslashes($q).'\'
IN BOOLEAN MODE)');
+            if (strtolower($q) != $q) {
+                $this->target->whereAdd('MATCH(content) ' .
+                                        'AGAINST
(\''.addslashes(strtolower($q)).'\' IN BOOLEAN MODE)', 'OR');
+            }
+            return true;
+        } else {
+            throw new ServerException('Unknown table: ' . $this->table);
+        }
    }
}

--
Mark
"Blessed is he who finds happiness in his own foolishness, for he will
always be happy."
_______________________________________________
Laconica-dev mailing list
[email protected]
http://mail.laconi.ca/mailman/listinfo/laconica-dev

Reply via email to