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

[ccplugin] add --except-etypes option to skip a given type

parent ab5d742735e5
No related branches found
No related tags found
No related merge requests found
......@@ -42,6 +42,9 @@
('etype', {'type': 'string', 'default': '',
'help': 'only index a given etype'
'[default:all indexable types]'}),
('except-etype', {'type': 'string', 'default': '',
'help': 'all indexable types except given etype'
'[default:None]'}),
]
def run(self, args):
......@@ -56,6 +59,8 @@
if self.config.etype:
etypes = (self.config.etype,)
else:
etypes = indexable_types(schema)
etypes = indexable_types(schema,
custom_skip_list=((self.config.except_etype,)))
assert self.config.except_etype not in etypes
if self.config.debug and not self.config.etype:
print(u'found indexable_types {}'.format(
......@@ -60,6 +65,6 @@
if self.config.debug and not self.config.etype:
print(u'found indexable_types {}'.format(
','.join(indexable_types(schema))))
','.join(etypes)))
for _ in parallel_bulk(es,
self.bulk_actions(etypes,
cnx,
......
......@@ -33,7 +33,7 @@
log = logging.getLogger(__name__)
def indexable_types(schema):
def indexable_types(schema, custom_skip_list=None):
'''
introspect indexable types
'''
......@@ -42,6 +42,9 @@
return INDEXABLE_TYPES
indexable_types = []
skip_list = ('TrInfo', 'EmailAddress')
if custom_skip_list:
skip_list = skip_list + custom_skip_list
print skip_list
for eschema in schema.entities():
if eschema.type in skip_list:
continue
......
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