diff --git a/apps/location/models.py b/apps/location/models.py index 32e5b6d7..76468d55 100644 --- a/apps/location/models.py +++ b/apps/location/models.py @@ -160,7 +160,7 @@ class WineRegionQuerySet(models.QuerySet): """Wine region queryset.""" -class WineRegion(models.Model): +class WineRegion(models.Model, TranslatedFieldsMixin): """Wine region model.""" name = models.CharField(_('name'), max_length=255) country = models.ForeignKey(Country, on_delete=models.PROTECT, diff --git a/apps/search_indexes/documents/product.py b/apps/search_indexes/documents/product.py index 94aea029..039f1bf1 100644 --- a/apps/search_indexes/documents/product.py +++ b/apps/search_indexes/documents/product.py @@ -16,13 +16,13 @@ class ProductDocument(Document): properties=OBJECT_FIELD_PROPERTIES) product_type = fields.ObjectField(properties={ 'id': fields.IntegerField(), - 'name': fields.ObjectField(properties=OBJECT_FIELD_PROPERTIES), + 'name': fields.ObjectField(attr='name_indexing', properties=OBJECT_FIELD_PROPERTIES), 'index_name': fields.KeywordField(), 'use_subtypes': fields.BooleanField(), }) subtypes = fields.ObjectField( properties={ - 'name': fields.ObjectField(properties=OBJECT_FIELD_PROPERTIES), + 'name': fields.ObjectField(attr='name_indexing', properties=OBJECT_FIELD_PROPERTIES), 'index_name': fields.KeywordField(), }, multi=True @@ -35,8 +35,8 @@ class ProductDocument(Document): properties=OBJECT_FIELD_PROPERTIES), 'code': fields.KeywordField(), }), - 'coordinates': fields.GeoPointField(), - 'description': fields.ObjectField(properties=OBJECT_FIELD_PROPERTIES), + # 'coordinates': fields.GeoPointField(), + 'description': fields.ObjectField(attr='description_indexing', properties=OBJECT_FIELD_PROPERTIES), }) wine_sub_region = fields.ObjectField(properties={'name': fields.KeywordField()}) classifications = fields.ObjectField( # TODO @@ -45,14 +45,14 @@ class ProductDocument(Document): 'standard': fields.ObjectField(properties={ 'name': fields.KeywordField(), 'standard_type': fields.IntegerField(), - 'coordinates': fields.GeoPointField(), + # 'coordinates': fields.GeoPointField(), }), 'tags': fields.ObjectField( properties={ - 'label': fields.ObjectField(properties=OBJECT_FIELD_PROPERTIES), + 'label': fields.ObjectField(attr='label_indexing', properties=OBJECT_FIELD_PROPERTIES), 'value': fields.KeywordField(), 'category': fields.ObjectField(properties={ - 'label': fields.ObjectField(properties=OBJECT_FIELD_PROPERTIES), + 'label': fields.ObjectField(attr='label_indexing', properties=OBJECT_FIELD_PROPERTIES), 'public': fields.BooleanField(), 'index_name': fields.KeywordField(), 'value_type': fields.KeywordField(), @@ -72,9 +72,9 @@ class ProductDocument(Document): standards = fields.ObjectField( properties={ 'id': fields.IntegerField(), - 'name': fields.ObjectField(attr='name_indexing', - properties=OBJECT_FIELD_PROPERTIES), - 'code': fields.KeywordField(), + 'name': fields.KeywordField(), + 'standard_type': fields.IntegerField(), + # 'coordinates': fields.GeoPointField(), }, multi=True ) @@ -83,10 +83,10 @@ class ProductDocument(Document): }) tags = fields.ObjectField( properties={ - 'label': fields.ObjectField(properties=OBJECT_FIELD_PROPERTIES), + 'label': fields.ObjectField(attr='label_indexing', properties=OBJECT_FIELD_PROPERTIES), 'value': fields.KeywordField(), 'category': fields.ObjectField(properties={ - 'label': fields.ObjectField(properties=OBJECT_FIELD_PROPERTIES), + 'label': fields.ObjectField(attr='label_indexing', properties=OBJECT_FIELD_PROPERTIES), 'public': fields.BooleanField(), 'index_name': fields.KeywordField(), 'value_type': fields.KeywordField(),