comparison podcast/search_indexes.py @ 753:ad53d929281a

For issue #62, upgrade Haystack from 1.2.7 to 2.1.0.
author Brian Neal <bgneal@gmail.com>
date Fri, 03 Jan 2014 19:01:18 -0600
parents ee87ea74d46b
children cf9918328c64
comparison
equal deleted inserted replaced
752:95f4e7f352fd 753:ad53d929281a
1 """Haystack search index for the news application.""" 1 """Haystack search index for the news application."""
2 from haystack.indexes import * 2 from haystack import indexes
3 from haystack import site
4 from custom_search.indexes import CondQueuedSearchIndex
5 3
6 from podcast.models import Item 4 from podcast.models import Item
7 5
8 6
9 class ItemIndex(CondQueuedSearchIndex): 7 class ItemIndex(indexes.SearchIndex, indexes.Indexable):
10 text = CharField(document=True, use_template=True) 8 text = indexes.CharField(document=True, use_template=True)
11 author = CharField(model_attr='author') 9 author = indexes.CharField(model_attr='author')
12 pub_date = DateTimeField(model_attr='pubdate') 10 pub_date = indexes.DateTimeField(model_attr='pubdate')
11
12 def get_model(self):
13 return Item
13 14
14 def get_updated_field(self): 15 def get_updated_field(self):
15 return 'update_date' 16 return 'update_date'
16
17
18 site.register(Item, ItemIndex)