Add wine_region and wine_sub_region to ES
This commit is contained in:
parent
f8c9a5c830
commit
83153b14c1
|
|
@ -64,7 +64,10 @@ class ProductDocument(Document):
|
|||
# 'coordinates': fields.GeoPointField(),
|
||||
'description': fields.ObjectField(attr='description_indexing', properties=OBJECT_FIELD_PROPERTIES),
|
||||
})
|
||||
wine_sub_region = fields.ObjectField(properties={'name': fields.KeywordField()})
|
||||
wine_sub_region = fields.ObjectField(properties={
|
||||
'id': fields.IntegerField(),
|
||||
'name': fields.KeywordField(),
|
||||
})
|
||||
classifications = fields.ObjectField( # TODO
|
||||
properties={
|
||||
'classification_type': fields.ObjectField(properties={}),
|
||||
|
|
|
|||
|
|
@ -197,21 +197,13 @@ class ProductDocumentViewSet(BaseDocumentViewSet):
|
|||
"""Product document ViewSet."""
|
||||
|
||||
document = ProductDocument
|
||||
# lookup_field = 'slug'
|
||||
pagination_class = ProjectMobilePagination
|
||||
permission_classes = (permissions.AllowAny,)
|
||||
serializer_class = serializers.ProductDocumentSerializer
|
||||
|
||||
# def get_queryset(self):
|
||||
# qs = super(ProductDocumentViewSet, self).get_queryset()
|
||||
# qs = qs.filter('match', is_publish=True)
|
||||
# return qs
|
||||
|
||||
filter_backends = [
|
||||
FilteringFilterBackend,
|
||||
filters.CustomSearchFilterBackend,
|
||||
# GeoSpatialFilteringFilterBackend,
|
||||
# DefaultOrderingFilterBackend,
|
||||
]
|
||||
|
||||
search_fields = {
|
||||
|
|
@ -234,14 +226,28 @@ class ProductDocumentViewSet(BaseDocumentViewSet):
|
|||
'slug': 'slug',
|
||||
'tags_id': {
|
||||
'field': 'tags.id',
|
||||
'lookups': [constants.LOOKUP_QUERY_IN]
|
||||
'lookups': [constants.LOOKUP_QUERY_IN],
|
||||
},
|
||||
'wine_colors_id': {
|
||||
'field': 'wine_colors.id',
|
||||
'lookups': [
|
||||
constants.LOOKUP_QUERY_IN,
|
||||
constants.LOOKUP_QUERY_EXCLUDE,
|
||||
]
|
||||
],
|
||||
},
|
||||
'wine_region_id': {
|
||||
'field': 'wine_region.id',
|
||||
'lookups': [
|
||||
constants.LOOKUP_QUERY_IN,
|
||||
constants.LOOKUP_QUERY_EXCLUDE,
|
||||
],
|
||||
},
|
||||
'wine_sub_region_id': {
|
||||
'field': 'wine_sub_region_id',
|
||||
'lookups': [
|
||||
constants.LOOKUP_QUERY_IN,
|
||||
constants.LOOKUP_QUERY_EXCLUDE,
|
||||
],
|
||||
},
|
||||
'grape_variety_id': {
|
||||
'field': 'grape_variety.id',
|
||||
|
|
@ -264,8 +270,6 @@ class ProductDocumentViewSet(BaseDocumentViewSet):
|
|||
'lookups': [
|
||||
constants.LOOKUP_QUERY_IN,
|
||||
constants.LOOKUP_QUERY_EXCLUDE,
|
||||
]
|
||||
}
|
||||
}
|
||||
# geo_spatial_filter_fields = {
|
||||
# }
|
||||
],
|
||||
},
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user