Exemple #1
0
 def _update_index():
     # For now, until some model/api issues are worked out for Audio
     # objects, we'll avoid using the cl_update_index command and do
     # this the hard way using tasks
     opinion_keys = Opinion.objects.values_list('pk', flat=True)
     add_or_update_opinions(opinion_keys)
     audio_keys = Audio.objects.values_list('pk', flat=True)
     add_or_update_audio_files(audio_keys)
Exemple #2
0
    def save(self, index=True, force_commit=False, *args, **kwargs):
        """
        Overrides the normal save method, but provides integration with the
        bulk files and with Solr indexing.

        :param index: Should the item be added to the Solr index?
        :param commit: Should a commit be performed after adding it?
        """
        super(Audio, self).save(*args, **kwargs)
        if index:
            from cl.search.tasks import add_or_update_audio_files
            add_or_update_audio_files([self.pk], force_commit)