bgneal@222: """Haystack search index for the weblinks application.""" bgneal@222: from haystack.indexes import * bgneal@222: from haystack import site bgneal@222: bgneal@222: from forums.models import Forum, Post bgneal@222: bgneal@222: bgneal@222: class PostIndex(SearchIndex): bgneal@222: text = CharField(document=True, use_template=True) bgneal@222: author = CharField(model_attr='user') bgneal@222: pub_date = DateTimeField(model_attr='creation_date') bgneal@222: bgneal@222: def get_queryset(self): bgneal@222: return Post.objects.filter( bgneal@222: topic__forum__in=Forum.objects.public_forums()) bgneal@222: bgneal@277: def get_updated_field(self): bgneal@277: return 'update_date' bgneal@277: bgneal@222: bgneal@222: site.register(Post, PostIndex)