Mercurial > public > sg101
comparison ygroup/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 """ | 1 """ |
2 Haystack search index for the Yahoo Group archives application. | 2 Haystack search index for the Yahoo Group archives application. |
3 | 3 |
4 """ | 4 """ |
5 from haystack.indexes import * | 5 from haystack import indexes |
6 from haystack import site | |
7 from custom_search.indexes import CondQueuedSearchIndex | |
8 | 6 |
9 from ygroup.models import Post | 7 from ygroup.models import Post |
10 | 8 |
11 | 9 |
12 class PostIndex(CondQueuedSearchIndex): | 10 class PostIndex(indexes.SearchIndex, indexes.Indexable): |
13 text = CharField(document=True, use_template=True) | 11 text = indexes.CharField(document=True, use_template=True) |
14 pub_date = DateTimeField(model_attr='creation_date') | 12 pub_date = indexes.DateTimeField(model_attr='creation_date') |
13 | |
14 def get_model(self): | |
15 return Post | |
15 | 16 |
16 def get_updated_field(self): | 17 def get_updated_field(self): |
17 return 'creation_date' | 18 return 'creation_date' |
18 | 19 |
19 | |
20 site.register(Post, PostIndex) |