This repository has been archived on 2025-05-04. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
s2forums/djangobb_forum/search_indexes.py

24 lines
757 B
Python
Raw Normal View History

2010-11-01 13:42:18 -03:00
from haystack.indexes import *
from haystack import site
from gargoyle import gargoyle
try:
if gargoyle.is_active('solr_indexing_enabled'):
from celery_haystack.indexes import CelerySearchIndex as SearchIndex
except:
# Allow migrations to run
from celery_haystack.indexes import CelerySearchIndex as SearchIndex
2013-04-24 14:15:45 +00:00
2010-11-01 13:42:18 -03:00
import djangobb_forum.models as models
class PostIndex(SearchIndex):
2010-11-01 13:42:18 -03:00
text = CharField(document=True, use_template=True)
author = CharField(model_attr='user')
created = DateTimeField(model_attr='created')
topic = CharField(model_attr='topic')
category = CharField(model_attr='topic__forum__category__name')
forum = IntegerField(model_attr='topic__forum__pk')
site.register(models.Post, PostIndex)