bgneal@220: """Haystack search index for the weblinks application.""" bgneal@753: from haystack import indexes bgneal@220: bgneal@943: from custom_search.fields import MaxTermSizeCharField bgneal@220: from weblinks.models import Link bgneal@220: bgneal@220: bgneal@753: class LinkIndex(indexes.SearchIndex, indexes.Indexable): bgneal@943: text = MaxTermSizeCharField(document=True, use_template=True) bgneal@753: author = indexes.CharField(model_attr='user') bgneal@753: pub_date = indexes.DateTimeField(model_attr='date_added') bgneal@220: bgneal@753: def get_model(self): bgneal@753: return Link bgneal@753: bgneal@753: def index_queryset(self, using=None): bgneal@220: return Link.public_objects.all() bgneal@220: bgneal@277: def get_updated_field(self): bgneal@277: return 'update_date' bgneal@277: