ES Establishment tags. indexing & search

This commit is contained in:
evgeniy-st 2019-09-18 11:46:53 +03:00
parent 2908286e6c
commit 39b2fc49b5
2 changed files with 15 additions and 4 deletions

View File

@ -18,8 +18,13 @@ class EstablishmentDocument(Document):
properties=OBJECT_FIELD_PROPERTIES)
tags = fields.ObjectField(
properties={
'id': fields.IntegerField(attr='id'),
'label': fields.ObjectField(attr='label')
'id': fields.IntegerField(attr='metadata.id'),
'label': fields.ObjectField(attr='metadata.label_indexing',
properties=OBJECT_FIELD_PROPERTIES),
'category': fields.ObjectField(attr='metadata.category',
properties={
'id': fields.IntegerField(),
})
},
multi=True)
address = fields.ObjectField(
@ -61,5 +66,5 @@ class EstablishmentDocument(Document):
'price_level',
)
def prepare_tags(self, instance):
return instance.tags_indexing
def get_queryset(self):
return super().get_queryset().published()

View File

@ -85,5 +85,11 @@ class EstablishmentDocumentViewSet(BaseDocumentViewSet):
},
'country': {
'field': 'address.city.country.code'
},
'tags_id': {
'field': 'tags.id',
},
'tags_category_id': {
'field': 'tags.category.id',
}
}