diff --git a/apps/establishment/models.py b/apps/establishment/models.py index e270832b..140188d7 100644 --- a/apps/establishment/models.py +++ b/apps/establishment/models.py @@ -610,6 +610,10 @@ class Establishment(GalleryModelMixin, ProjectBaseMixin, URLImageMixin, def restaurant_cuisine_indexing(self): return self.tags.filter(category__index_name='cuisine') + @property + def artisan_category_indexing(self): + return self.tags.filter(category__index_name='shop_category') + class EstablishmentNoteQuerySet(models.QuerySet): """QuerySet for model EstablishmentNote.""" diff --git a/apps/establishment/serializers/common.py b/apps/establishment/serializers/common.py index 6a88c5d4..37432a21 100644 --- a/apps/establishment/serializers/common.py +++ b/apps/establishment/serializers/common.py @@ -322,6 +322,7 @@ class EstablishmentListRetrieveSerializer(EstablishmentBaseSerializer): schedule = ScheduleRUDSerializer(many=True, allow_null=True) restaurant_category = TagBaseSerializer(read_only=True, many=True, allow_null=True) restaurant_cuisine = TagBaseSerializer(read_only=True, many=True, allow_null=True) + artisan_category = TagBaseSerializer(read_only=True, many=True, allow_null=True) class Meta(EstablishmentBaseSerializer.Meta): """Meta class.""" @@ -330,6 +331,7 @@ class EstablishmentListRetrieveSerializer(EstablishmentBaseSerializer): 'schedule', 'restaurant_category', 'restaurant_cuisine', + 'artisan_category', ] diff --git a/apps/establishment/views/web.py b/apps/establishment/views/web.py index 5c73feb6..cfd4880e 100644 --- a/apps/establishment/views/web.py +++ b/apps/establishment/views/web.py @@ -38,6 +38,7 @@ class EstablishmentListView(EstablishmentMixinView, generics.ListAPIView): .with_extended_address_related().with_currency_related() \ .with_certain_tag_category_related('category', 'restaurant_category') \ .with_certain_tag_category_related('cuisine', 'restaurant_cuisine') \ + .with_ceratin_tag_category_related('shop_category', 'artisan_category') class EstablishmentRetrieveView(EstablishmentMixinView, generics.RetrieveAPIView): diff --git a/apps/search_indexes/documents/establishment.py b/apps/search_indexes/documents/establishment.py index 9cfc27d3..9e1d0a82 100644 --- a/apps/search_indexes/documents/establishment.py +++ b/apps/search_indexes/documents/establishment.py @@ -65,6 +65,14 @@ class EstablishmentDocument(Document): 'value': fields.KeywordField(), }, multi=True, attr='restaurant_cuisine_indexing') + artisan_category = fields.ObjectField( + properties={ + 'id': fields.IntegerField(attr='id'), + 'label': fields.ObjectField(attr='label_indexing', + properties=OBJECT_FIELD_PROPERTIES), + 'value': fields.KeywordField(), + }, + multi=True, attr='artisan_category_indexing') visible_tags = fields.ObjectField( properties={ 'id': fields.IntegerField(attr='id'), diff --git a/apps/search_indexes/serializers.py b/apps/search_indexes/serializers.py index 62b5560f..1a7c7132 100644 --- a/apps/search_indexes/serializers.py +++ b/apps/search_indexes/serializers.py @@ -231,6 +231,7 @@ class EstablishmentDocumentSerializer(InFavoritesMixin, DocumentSerializer): tags = TagsDocumentSerializer(many=True, source='visible_tags') restaurant_category = TagsDocumentSerializer(many=True) restaurant_cuisine = TagsDocumentSerializer(many=True) + artisan_category = TagsDocumentSerializer(many=True) schedule = ScheduleDocumentSerializer(many=True, allow_null=True) class Meta: @@ -251,6 +252,7 @@ class EstablishmentDocumentSerializer(InFavoritesMixin, DocumentSerializer): 'tags', 'restaurant_category', 'restaurant_cuisine', + 'artisan_category', 'schedule', 'works_noon', 'works_evening',