Source code for publishers.search_indexes

from haystack import indexes

from .models import Publisher


[docs]class PublisherIndex(indexes.SearchIndex, indexes.Indexable): text = indexes.CharField(document=True, use_template=True) num_papers = indexes.IntegerField(model_attr='stats__num_tot') oa_status = indexes.CharField(model_attr='oa_status') name = indexes.CharField(model_attr='name')
[docs] def get_model(self): return Publisher
[docs] def index_queryset(self, using=None): return self.get_model().objects.filter(stats__isnull=False)