Also a little higher.
[prawokultury.git] / questions / search_indexes.py
1 import datetime
2 from django.conf import settings
3 from haystack import indexes
4 from .models import Question
5
6
7 class QuestionIndex(indexes.SearchIndex, indexes.Indexable):
8     text = indexes.CharField(document=True)
9     answer = indexes.CharField(model_attr="answer")
10
11     def prepare_text(self, obj):
12         return unicode(obj)
13
14     def get_model(self):
15         return Question
16
17     def index_queryset(self, using=None):
18         """Used when the entire index for model is updated."""
19         return self.get_model().objects.filter(published=True)