title = indexes.CharField(model_attr='title')
owner = indexes.CharField(model_attr='owner__name')

def get_model(self):
    return MyFile

def index_queryset(self, using=None):
    return self.get_model().objects.all()

def prepare(self, obj):
    data = super(FileIndex, self).prepare(obj)
file_obj = obj.the_file.open()
extracted_data = self.backend.extract_file_contents(file_obj)
t = loader.select_template(('search/indexes/myapp/myfile_text.txt',))
data['text'] = t.render(Context({'object': obj, 'extracted': extracted_data}))
return data
Интеграция извлеченного содержимого PDF с помощью django-haystack