Mercurial > public > sg101
annotate gpp/ygroup/search_indexes.py @ 388:c3231af55778
For #191; r410 is wrong: it is returning the wrong posts. Rework. MySQL is not using an index on our query, and it is taking 10+ seconds. Replace this slow query with a loop that loops over the public forums, then sorts and returns the posts.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 19 Mar 2011 05:03:51 +0000 |
parents | 0c18dfb1da1c |
children | 79240675b903 |
rev | line source |
---|---|
bgneal@323 | 1 """ |
bgneal@323 | 2 Haystack search index for the Yahoo Group archives application. |
bgneal@323 | 3 |
bgneal@323 | 4 """ |
bgneal@323 | 5 from haystack.indexes import * |
bgneal@323 | 6 from haystack import site |
bgneal@323 | 7 |
bgneal@323 | 8 from ygroup.models import Post |
bgneal@323 | 9 |
bgneal@323 | 10 |
bgneal@323 | 11 class PostIndex(SearchIndex): |
bgneal@323 | 12 text = CharField(document=True, use_template=True) |
bgneal@323 | 13 pub_date = DateTimeField(model_attr='creation_date') |
bgneal@323 | 14 |
bgneal@323 | 15 def get_updated_field(self): |
bgneal@323 | 16 return 'creation_date' |
bgneal@323 | 17 |
bgneal@323 | 18 |
bgneal@323 | 19 site.register(Post, PostIndex) |