diff --git a/es.py b/es.py new file mode 100644 index 0000000000000000000000000000000000000000..67b13eecf542a9e12b5d2332701190d9afc555ff_ZXMucHk= --- /dev/null +++ b/es.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# copyright 2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved. +# contact http://www.logilab.fr -- mailto:contact@logilab.fr + +INDEXABLE_TYPES = None + + +def index_settings(): + return {'analysis': + {'analyzer': + {'default': {'filter': ['standard', + 'my_ascii_folding'], + 'tokenizer': 'standard'}}, + 'filter': {'my_ascii_folding': {'preserve_original': True, + 'type': 'asciifolding'}}}} + + +def indexable_types(schema): + global INDEXABLE_TYPES + if INDEXABLE_TYPES is not None: + return INDEXABLE_TYPES + indexable_types = [] + skip_list = ('TrInfo', 'EmailAddress') + for eschema in schema.entities(): + if eschema.type in skip_list: + continue + if not eschema.final: + # check eschema.fulltext_relations() ? (skip wf_info_for ? + # ) + if list(eschema.indexable_attributes()): + indexable_types.append(eschema.type) + INDEXABLE_TYPES = indexable_types + return indexable_types