ES. Establishment type & subtypes

This commit is contained in:
evgeniy-st 2019-09-18 16:40:07 +03:00
parent 4005fad64a
commit 8e0b19b8b0
3 changed files with 27 additions and 4 deletions

View File

@ -16,6 +16,19 @@ class EstablishmentDocument(Document):
description = fields.ObjectField(attr='description_indexing',
properties=OBJECT_FIELD_PROPERTIES)
establishment_type = fields.ObjectField(
properties={
'id': fields.IntegerField(),
'name': fields.ObjectField(attr='name_indexing',
properties=OBJECT_FIELD_PROPERTIES)
})
establishment_subtypes = fields.ObjectField(
properties={
'id': fields.IntegerField(),
'name': fields.ObjectField(attr='name_indexing',
properties=OBJECT_FIELD_PROPERTIES)
},
multi=True)
tags = fields.ObjectField(
properties={
'id': fields.IntegerField(attr='metadata.id'),
@ -55,10 +68,12 @@ class EstablishmentDocument(Document):
),
}
)
collections = fields.ObjectField(properties={
collections = fields.ObjectField(
properties={
'id': fields.IntegerField(attr='collection.id'),
'collection_type': fields.IntegerField(attr='collection.collection_type'),
})
},
multi=True)
class Django:

View File

@ -61,6 +61,8 @@ class EstablishmentDocumentSerializer(DocumentSerializer):
'tags',
'address',
'collections',
'establishment_type',
'establishment_subtypes',
)
@staticmethod

View File

@ -97,6 +97,12 @@ class EstablishmentDocumentViewSet(BaseDocumentViewSet):
'collection_type': {
'field': 'collections.collection_type'
},
'establishment_type': {
'field': 'establishment_type.id'
},
'establishment_subtypes': {
'field': 'establishment_subtypes.id'
},
}
geo_spatial_filter_fields = {