hide es search
This commit is contained in:
parent
bd7ba611fc
commit
bb41f00451
|
|
@ -11,7 +11,6 @@ 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 as Elastic_Q
|
||||
from phonenumber_field.modelfields import PhoneNumberField
|
||||
|
||||
from collection.models import Collection
|
||||
|
|
@ -99,15 +98,15 @@ class EstablishmentQuerySet(models.QuerySet):
|
|||
else:
|
||||
return self.none()
|
||||
|
||||
def es_search(self, value, locale=None):
|
||||
"""Search text via ElasticSearch."""
|
||||
from search_indexes.documents import EstablishmentDocument
|
||||
search = EstablishmentDocument.search().filter(
|
||||
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)
|
||||
# def es_search(self, value, locale=None):
|
||||
# """Search text via ElasticSearch."""
|
||||
# from search_indexes.documents import EstablishmentDocument
|
||||
# search = EstablishmentDocument.search().filter(
|
||||
# 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)
|
||||
|
||||
def by_country_code(self, code):
|
||||
"""Return establishments by country code"""
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user