-
Notifications
You must be signed in to change notification settings - Fork 29
/
search.py
25 lines (21 loc) · 1.04 KB
/
search.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from elasticsearch_dsl import TermsFacet
from core.collections.models import Collection
from core.common.constants import FACET_SIZE
from core.common.search import CustomESFacetedSearch
class CollectionFacetedSearch(CustomESFacetedSearch):
index = 'collections'
doc_types = [Collection]
fields = [
'collection_type', 'locale', 'owner', 'owner_type', 'is_active', 'version', 'custom_validation_schema',
'name', 'mnemonic', 'extras', 'identifier', 'publisher', 'immutable', 'updated_by'
]
facets = {
'collectionType': TermsFacet(field='collection_type', size=FACET_SIZE),
'locale': TermsFacet(field='locale', size=FACET_SIZE),
'owner': TermsFacet(field='owner', size=FACET_SIZE),
'ownerType': TermsFacet(field='owner_type'),
'is_active': TermsFacet(field='is_active'),
'version': TermsFacet(field='version', size=FACET_SIZE),
'customValidationSchema': TermsFacet(field='custom_validation_schema'),
'updatedBy': TermsFacet(field='updated_by', size=FACET_SIZE),
}