From: hernani Date: Tue, 5 Apr 2011 17:07:16 +0000 (+0000) Subject: Forces case insensitivity on mysql fts by forcin upper case. X-Git-Tag: live~377 X-Git-Url: https://git.openstreetmap.org./osqa.git/commitdiff_plain/64fe9d425edc29234d9a6bf4dc23c52673fd2bdf Forces case insensitivity on mysql fts by forcin upper case. git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@933 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- diff --git a/forum_modules/mysqlfulltext/fts_install.sql b/forum_modules/mysqlfulltext/fts_install.sql index 4cd6bd1..5ad821e 100644 --- a/forum_modules/mysqlfulltext/fts_install.sql +++ b/forum_modules/mysqlfulltext/fts_install.sql @@ -14,7 +14,7 @@ delimiter | CREATE TRIGGER fts_on_insert AFTER INSERT ON forum_node FOR EACH ROW BEGIN - INSERT INTO forum_mysqlftsindex (node_id, body) VALUES (NEW.id, CONCAT_WS('\n', NEW.title, NEW.body, NEW.tagnames)); + INSERT INTO forum_mysqlftsindex (node_id, body) VALUES (NEW.id, UPPER(CONCAT_WS('\n', NEW.title, NEW.body, NEW.tagnames))); END; | @@ -23,9 +23,9 @@ delimiter | CREATE TRIGGER fts_on_update AFTER UPDATE ON forum_node FOR EACH ROW BEGIN - UPDATE forum_mysqlftsindex SET body = CONCAT_WS('\n', NEW.title, NEW.body, NEW.tagnames) WHERE node_id = NEW.id; + UPDATE forum_mysqlftsindex SET body = UPPER(CONCAT_WS('\n', NEW.title, NEW.body, NEW.tagnames)) WHERE node_id = NEW.id; END; | -INSERT INTO forum_mysqlftsindex (node_id, body) SELECT id, CONCAT_WS('\n', title, body, tagnames) FROM forum_node; \ No newline at end of file +INSERT INTO forum_mysqlftsindex (node_id, body) SELECT id, UPPER(CONCAT_WS('\n', title, body, tagnames)) FROM forum_node; \ No newline at end of file diff --git a/forum_modules/mysqlfulltext/startup.py b/forum_modules/mysqlfulltext/startup.py index 363b4e1..b1031a5 100644 --- a/forum_modules/mysqlfulltext/startup.py +++ b/forum_modules/mysqlfulltext/startup.py @@ -31,4 +31,4 @@ word_re = re.compile(r'\w+', re.UNICODE) @decorate(QuestionManager.search, needs_origin=False) def question_search(self, keywords): - return False, self.filter(models.Q(ftsindex__body__search=keywords)) \ No newline at end of file + return False, self.filter(models.Q(ftsindex__body__search=keywords.upper())) \ No newline at end of file