diff options
author | unknown <COOL@.(none)> | 2010-02-02 20:25:25 +0000 |
---|---|---|
committer | unknown <COOL@.(none)> | 2010-02-02 20:25:25 +0000 |
commit | 23245d01db7eeee3243d8eaf33129b50b44dcdb0 (patch) | |
tree | ffd8b276aeec0bddfab9711d717147a4f55a7ef9 /pgfulltext | |
parent | 7938b2e38456c3a1d81f5aa127b188e90849cc15 (diff) | |
download | askbot-23245d01db7eeee3243d8eaf33129b50b44dcdb0.tar.gz askbot-23245d01db7eeee3243d8eaf33129b50b44dcdb0.tar.bz2 askbot-23245d01db7eeee3243d8eaf33129b50b44dcdb0.zip |
added full text search support for postgresql, database setup is done as a response to the post_syncdb signal. search is done against question summary, title and tags with crescent weight respectively. everything works but is still in a early stage of development
Diffstat (limited to 'pgfulltext')
-rw-r--r-- | pgfulltext/__init__.py | 0 | ||||
-rw-r--r-- | pgfulltext/management.py | 23 |
2 files changed, 23 insertions, 0 deletions
diff --git a/pgfulltext/__init__.py b/pgfulltext/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/pgfulltext/__init__.py diff --git a/pgfulltext/management.py b/pgfulltext/management.py new file mode 100644 index 00000000..04303092 --- /dev/null +++ b/pgfulltext/management.py @@ -0,0 +1,23 @@ +import os + +from django.db import connection, transaction +from django.conf import settings + +import forum.models + +if settings.USE_PG_FTS: + from django.db.models.signals import post_syncdb + + def setup_pgfulltext(sender, **kwargs): + if sender == forum.models: + install_pg_fts() + + post_syncdb.connect(setup_pgfulltext) + +def install_pg_fts(): + f = open(os.path.join(os.path.dirname(__file__), '../sql_scripts/pg_fts_install.sql'), 'r') + cursor = connection.cursor() + cursor.execute(f.read()) + transaction.commit_unless_managed() + f.close() +
\ No newline at end of file |