bgneal@223: """Haystack search index for the bio application.""" bgneal@223: from haystack.indexes import * bgneal@223: from haystack import site bgneal@469: from custom_search.indexes import CondQueuedSearchIndex bgneal@223: bgneal@223: from bio.models import UserProfile bgneal@223: bgneal@223: bgneal@467: class UserProfileIndex(CondQueuedSearchIndex): bgneal@223: text = CharField(document=True, use_template=True) bgneal@223: author = CharField(model_attr='user') bgneal@223: bgneal@223: def get_queryset(self): bgneal@223: return UserProfile.objects.filter(user__is_active=True) bgneal@223: bgneal@277: def get_updated_field(self): bgneal@277: return 'update_date' bgneal@277: bgneal@467: def can_index(self, instance): bgneal@467: return instance.user.is_active bgneal@467: bgneal@223: bgneal@223: site.register(UserProfile, UserProfileIndex)