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