summaryrefslogtreecommitdiffstats
path: root/forum/search/indexer.py
diff options
context:
space:
mode:
Diffstat (limited to 'forum/search/indexer.py')
-rw-r--r--forum/search/indexer.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/forum/search/indexer.py b/forum/search/indexer.py
new file mode 100644
index 00000000..c7c45c59
--- /dev/null
+++ b/forum/search/indexer.py
@@ -0,0 +1,9 @@
+from django.conf import settings
+from django.db import connection
+
+def create_fulltext_indexes():
+ if settings.DATABASE_ENGINE == 'mysql':
+ cursor = connection.cursor()
+ cursor.execute('ALTER TABLE question ADD FULLTEXT (title, text, tagnames)')
+ cursor.execute('ALTER TABLE answer ADD FULLTEXT (title, text, tagnames)')
+