2 from django.conf import settings
3 from haystack import indexes
4 from .models import Question
7 class QuestionIndex(indexes.RealTimeSearchIndex, indexes.Indexable):
8 text = indexes.CharField(document=True, model_attr="__unicode__")
9 answer = indexes.CharField(model_attr="answer")
14 def index_queryset(self):
15 """Used when the entire index for model is updated."""
16 return self.get_model().objects.filter(published=True)