update establishment search view
This commit is contained in:
parent
a190f2ca88
commit
7a021a1435
|
|
@ -1,5 +1,6 @@
|
||||||
"""Search indexes app views."""
|
"""Search indexes app views."""
|
||||||
from rest_framework import permissions
|
from rest_framework import permissions
|
||||||
|
from django_elasticsearch_dsl_drf import constants
|
||||||
from django_elasticsearch_dsl_drf.filter_backends import FilteringFilterBackend
|
from django_elasticsearch_dsl_drf.filter_backends import FilteringFilterBackend
|
||||||
from django_elasticsearch_dsl_drf.viewsets import BaseDocumentViewSet
|
from django_elasticsearch_dsl_drf.viewsets import BaseDocumentViewSet
|
||||||
from django_elasticsearch_dsl_drf.pagination import PageNumberPagination
|
from django_elasticsearch_dsl_drf.pagination import PageNumberPagination
|
||||||
|
|
@ -51,13 +52,30 @@ class EstablishmentDocumentViewSet(BaseDocumentViewSet):
|
||||||
search_fields = (
|
search_fields = (
|
||||||
'name',
|
'name',
|
||||||
'description',
|
'description',
|
||||||
'public_mark',
|
|
||||||
'toque_number',
|
|
||||||
'price_level',
|
|
||||||
)
|
)
|
||||||
translated_search_fields = (
|
translated_search_fields = (
|
||||||
'description',
|
'description',
|
||||||
)
|
)
|
||||||
filter_fields = {
|
filter_fields = {
|
||||||
'tag': 'tags.id'
|
'tag': 'tags.id',
|
||||||
|
'toque_number': {
|
||||||
|
'field': 'toque_number',
|
||||||
|
'lookups': [
|
||||||
|
constants.LOOKUP_FILTER_RANGE,
|
||||||
|
constants.LOOKUP_QUERY_GT,
|
||||||
|
constants.LOOKUP_QUERY_GTE,
|
||||||
|
constants.LOOKUP_QUERY_LT,
|
||||||
|
constants.LOOKUP_QUERY_LTE,
|
||||||
|
]
|
||||||
|
},
|
||||||
|
'price_level': {
|
||||||
|
'field': 'price_level',
|
||||||
|
'lookups': [
|
||||||
|
constants.LOOKUP_FILTER_RANGE,
|
||||||
|
constants.LOOKUP_QUERY_GT,
|
||||||
|
constants.LOOKUP_QUERY_GTE,
|
||||||
|
constants.LOOKUP_QUERY_LT,
|
||||||
|
constants.LOOKUP_QUERY_LTE,
|
||||||
|
]
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user