# based on http://anthony-tresontani.github.io/Django/2012/09/20/multilingual-search/
import re
from django.conf import settings
from django.utils import translation
from haystack import connections
from haystack.backends.solr_backend import SolrEngine, SolrSearchBackend, SolrSearchQuery
from haystack.constants import DEFAULT_ALIAS

def get_using(language, alias=DEFAULT_ALIAS):
    new_using = alias + "_" + language
    using = new_using if new_using in settings.HAYSTACK_CONNECTIONS else alias
    return using

class MultilingualSolrSearchBackend(SolrSearchBackend):
    def update(self, index, iterable, commit=True):
        # do not allow calling update on a multilingual backend
        if re.search(r'_[\w]{2}$', self.connection_alias):
            return
        initial_language = translation.get_language()[:2]
        # retrieve unique backend name
        backends = []
        for language, __ in settings.LANGUAGES:
            using = get_using(language, alias=self.connection_alias)
            # Ensure each backend is called only once
            if using in backends:
                continue
            else:
                backends.append(using)
            translation.activate(language)
            backend = connections[using].get_backend()
            print('[%s]' % using)
            super(MultilingualSolrSearchBackend, backend).update(index, iterable, commit)

        translation.activate(initial_language)

class MultilingualSolrSearchQuery(SolrSearchQuery):
    def __init__(self, using=DEFAULT_ALIAS):
        language = translation.get_language()[:2]
        using = get_using(language)
        super(MultilingualSolrSearchQuery, self).__init__(using=using)

class MultilingualSolrEngine(SolrEngine):
    backend = MultilingualSolrSearchBackend
    query = MultilingualSolrSearchQuery

@@ -510,16 +510,17 @@
  using%0A%0A
+%0A
 class Mu
@@ -579,49 +579,59 @@
 def 
-update(self, index, iterable, commit=True
+_multi_backend_run(self, func_name, *args, **kwargs
 ):%0A 
@@ -1313,32 +1313,47 @@
 ng)%0A            
+func = getattr(
 super(Multilingu
@@ -1385,16 +1385,125 @@
 end)
-.
+, func_name)%0A            func(*args, **kwargs)%0A%0A        translation.activate(initial_language)%0A%0A    def 
 update(
+self, 
 inde
@@ -1521,18 +1521,23 @@
 , commit
-)%0A
+=True):
 %0A       
@@ -1541,46 +1541,197 @@
     
-translation.activate(initial_language)
+self._multi_backend_run('update', index, iterable, commit=commit)%0A%0A    def remove(self, obj_or_string, commit=True):%0A        self._multi_backend_run('remove', obj_or_string, commit=commit)%0A
 %0A%0Acl
@@ -1983,16 +1983,17 @@
 using)%0A%0A
+%0A
 class Mu

Make Haystack remove operation use multilingual backends