bgneal@221: """Haystack search index for the downloads application.""" bgneal@753: from haystack import indexes bgneal@221: bgneal@943: from custom_search.fields import MaxTermSizeCharField bgneal@221: from downloads.models import Download bgneal@221: bgneal@221: bgneal@753: class DownloadIndex(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@221: bgneal@753: def get_model(self): bgneal@753: return Download bgneal@753: bgneal@753: def index_queryset(self, using=None): bgneal@221: return Download.public_objects.all() bgneal@221: bgneal@277: def get_updated_field(self): bgneal@277: return 'update_date'