Haystack 2 compatibility.
[prawokultury.git] / questions / search_indexes.py
index 1e36f41..ae126f0 100755 (executable)
@@ -4,10 +4,13 @@ from haystack import indexes
 from .models import Question
 
 
-class QuestionIndex(indexes.RealTimeSearchIndex, indexes.Indexable):
-    text = indexes.CharField(document=True, model_attr="__unicode__")
+class QuestionIndex(indexes.SearchIndex, indexes.Indexable):
+    text = indexes.CharField(document=True)
     answer = indexes.CharField(model_attr="answer")
 
+    def prepare_text(self, obj):
+        return unicode(obj)
+
     def get_model(self):
         return Question