diff options
Diffstat (limited to 'forum/models.py')
-rw-r--r-- | forum/models.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/forum/models.py b/forum/models.py index 39058bea..60fcee0a 100644 --- a/forum/models.py +++ b/forum/models.py @@ -14,6 +14,10 @@ from django.utils.translation import ugettext as _ from django.utils.safestring import mark_safe import django.dispatch import settings +import logging + +if settings.USE_SPHINX_SEARCH == True: + from djangosphinx.models import SphinxSearch from forum.managers import * from const import * @@ -184,6 +188,13 @@ class Question(models.Model): votes = generic.GenericRelation(Vote) flagged_items = generic.GenericRelation(FlaggedItem) + if settings.USE_SPHINX_SEARCH == True: + search = SphinxSearch( + index=' '.join(settings.SPHINX_SEARCH_INDICES), + mode='SPH_MATCH_ALL', + ) + logging.debug('have sphinx search') + objects = QuestionManager() def save(self, **kwargs): |