bgneal@220: """Haystack search index for the weblinks application.""" bgneal@220: from haystack.indexes import * bgneal@220: from haystack import site bgneal@220: bgneal@220: from weblinks.models import Link bgneal@220: bgneal@220: bgneal@220: class LinkIndex(SearchIndex): bgneal@220: text = CharField(document=True, use_template=True) bgneal@220: author = CharField(model_attr='user') bgneal@220: pub_date = DateTimeField(model_attr='date_added') bgneal@220: bgneal@220: def get_queryset(self): bgneal@220: return Link.public_objects.all() bgneal@220: bgneal@277: def get_updated_field(self): bgneal@277: return 'update_date' bgneal@277: bgneal@220: bgneal@220: site.register(Link, LinkIndex)