From bd7ba611fc399ff5b6dd9eda0f3d8269f2616b79 Mon Sep 17 00:00:00 2001 From: Kuroshini Date: Thu, 10 Oct 2019 14:28:42 +0300 Subject: [PATCH] Fix imports issue --- apps/establishment/models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/establishment/models.py b/apps/establishment/models.py index 43bc2f94..4b4cbbea 100644 --- a/apps/establishment/models.py +++ b/apps/establishment/models.py @@ -11,7 +11,7 @@ from django.db import models from django.db.models import When, Case, F, ExpressionWrapper, Subquery, Q from django.utils import timezone from django.utils.translation import gettext_lazy as _ -from elasticsearch_dsl import Q +from elasticsearch_dsl import Q as Elastic_Q from phonenumber_field.modelfields import PhoneNumberField from collection.models import Collection @@ -103,8 +103,8 @@ class EstablishmentQuerySet(models.QuerySet): """Search text via ElasticSearch.""" from search_indexes.documents import EstablishmentDocument search = EstablishmentDocument.search().filter( - Q('match', name=value) | - Q('match', **{f'description.{locale}': value}) + Elastic_Q('match', name=value) | + Elastic_Q('match', **{f'description.{locale}': value}) ).execute() ids = [result.meta.id for result in search] return self.filter(id__in=ids)