Permalink
Browse files

haystack development version compat

  • Loading branch information...
1 parent 3e61333 commit fe325aa4fb7e455cd3b33f58b482211bc4fb3155 @wardi committed Apr 11, 2012
Showing with 25 additions and 25 deletions.
  1. +25 −25 pages/search_indexes.py
View
50 pages/search_indexes.py
@@ -3,34 +3,34 @@
from pages import settings
from haystack.indexes import SearchIndex, CharField, DateTimeField, RealTimeSearchIndex
-from haystack import site
-
-
-class PageIndex(SearchIndex):
- """Search index for pages content."""
- text = CharField(document=True, use_template=True)
- title = CharField(model_attr='title')
- url = CharField(model_attr='get_absolute_url')
- publication_date = DateTimeField(model_attr='publication_date')
-
- def get_queryset(self):
- """Used when the entire index for model is updated."""
- return Page.objects.published()
+if settings.PAGE_REAL_TIME_SEARCH:
+ class RealTimePageIndex(RealTimeSearchIndex):
+ """Search index for pages content."""
+ text = CharField(document=True, use_template=True)
+ title = CharField(model_attr='title')
+ url = CharField(model_attr='get_absolute_url')
+ publication_date = DateTimeField(model_attr='publication_date')
-class RealTimePageIndex(RealTimeSearchIndex):
- """Search index for pages content."""
- text = CharField(document=True, use_template=True)
- title = CharField(model_attr='title')
- url = CharField(model_attr='get_absolute_url')
- publication_date = DateTimeField(model_attr='publication_date')
+ def get_queryset(self):
+ """Used when the entire index for model is updated."""
+ return Page.objects.published()
- def get_queryset(self):
- """Used when the entire index for model is updated."""
- return Page.objects.published()
+ def get_model(self):
+ Page
-if settings.PAGE_REAL_TIME_SEARCH:
- site.register(Page, RealTimePageIndex)
else:
- site.register(Page, PageIndex)
+ class PageIndex(SearchIndex):
+ """Search index for pages content."""
+ text = CharField(document=True, use_template=True)
+ title = CharField(model_attr='title')
+ url = CharField(model_attr='get_absolute_url')
+ publication_date = DateTimeField(model_attr='publication_date')
+
+ def get_queryset(self):
+ """Used when the entire index for model is updated."""
+ return Page.objects.published()
+
+ def get_model(self):
+ Page

0 comments on commit fe325aa

Please sign in to comment.