Commits

Stefan Scherfke committed 87fddd6

Updated search index for haystack 2.1

Comments (0)

Files changed (1)

weblog/search_indexes.py

-# encoding: utf-8
 """
 Search indexes for Haystack.
 
 """
-from haystack import indexes, site
+from haystack import indexes
 
 from weblog.models import Post
 
 
-class PostIndex(indexes.RealTimeSearchIndex):
-    """
-    Index for :class:`~weblog.models.Post`.
+class PostIndex(indexes.SearchIndex, indexes.Indexable):
+    """Index for :class:`~weblog.models.Post`.
 
     """
     text = indexes.CharField(document=True, use_template=True)
     title = indexes.CharField(model_attr='title')
     pub_date = indexes.DateTimeField(model_attr='pub_date')
 
-    def get_queryset(self):
+    def get_model(self):
+        return Post
+
+    def index_queryset(self, using=None):
         """Used when the entire index for model is updated."""
         return Post.published.all()
-
-
-site.register(Post, PostIndex)