Skip to content
Snippets Groups Projects
Commit 67b13eecf542 authored by Arthur Lutz's avatar Arthur Lutz
Browse files

[es.py] small library to compute indexable types

parent 70fdf9d3b424
No related branches found
No related tags found
No related merge requests found
es.py 0 → 100644
# -*- 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment