diff --git a/celery_haystack_index/queued_indexer.py b/celery_haystack_index/queued_indexer.py index bcbc2cb..9eec112 100644 --- a/celery_haystack_index/queued_indexer.py +++ b/celery_haystack_index/queued_indexer.py @@ -1,14 +1,14 @@ from django.db.models import signals from django.db.models.loading import get_model +from haystack import connections from haystack import indexes -from haystack import site from tasks import SearchIndexUpdateTask def remove_instance_from_index(instance): model_class = get_model(instance._meta.app_label, instance._meta.module_name) - search_index = site.get_index(model_class) + search_index = connections['default'].get_unified_index.get_index(model_class) search_index.remove_object(instance) class QueuedSearchIndex(indexes.SearchIndex): diff --git a/celery_haystack_index/tasks.py b/celery_haystack_index/tasks.py index e310ddb..c877b69 100644 --- a/celery_haystack_index/tasks.py +++ b/celery_haystack_index/tasks.py @@ -1,6 +1,6 @@ from django.db.models.loading import get_model -from haystack import site +from haystack import connections from haystack.management.commands import update_index from celery.task import Task, PeriodicTask @@ -17,7 +17,7 @@ def run(self, app_name, model_name, pk, **kwargs): try: model_class = get_model(app_name, model_name) instance = model_class.objects.get(pk=pk) - search_index = site.get_index(model_class) + search_index = connections['default'].get_unified_index.get_index(model_class) search_index.update_object(instance) except Exception, exc: logger.error(exc)