old_contents: import datetime
  from django.conf import settings
  from haystack import indexes
  from fnpdjango.utils.models.translation import add_translatable_index
  from events.models import Event
  
  
  class EventIndex(indexes.RealTimeSearchIndex, indexes.Indexable):
      def get_model(self):
          return Event
  
      def index_queryset(self):
          """Used when the entire index for model is updated."""
          return self.get_model().objects.all()
  
  
  add_translatable_index(EventIndex, {
  # Haystack needs a main field to be the same across all indexes
  # so we treat title of the event as this main content, named 'body'
     'body': indexes.CharField(model_attr='title', null=True),
     'organizer': indexes.CharField(null=True),
     'place': indexes.CharField(null=True)
     })
  
  
  getattr(EventIndex, "body_%s" % settings.LANGUAGE_CODE).document = True
  
new_contents: import datetime
  from django.conf import settings
  from haystack import indexes
  from fnpdjango.utils.models.translation import add_translatable_index, localize_field
  from events.models import Event
  
  
  class EventIndex(indexes.RealTimeSearchIndex, indexes.Indexable):
      text = indexes.CharField(null=True,
          model_attr=localize_field('title', settings.LANGUAGE_CODE),
          document=True)
  
      def get_model(self):
          return Event
  
      def index_queryset(self):
          """Used when the entire index for model is updated."""
          return self.get_model().objects.all()
  
  
  add_translatable_index(EventIndex, {
      'organizer': indexes.CharField(null=True),
      'place': indexes.CharField(null=True)
      })
  
  add_translatable_index(EventIndex, {
      'title': indexes.CharField(null=True),
      }, 
      (lang for lang in settings.LANGUAGES if lang[0] != settings.LANGUAGE_CODE)
  )
  
subject: fix events search index