Skip to content
Snippets Groups Projects
Commit 1cfb8bd26fe6 authored by Adrien Di Mascio's avatar Adrien Di Mascio
Browse files

[ccplugin] provide a --chunksize option to index-in-es

related to #17090555
parent 56ae3afb23f2
No related branches found
No related tags found
No related merge requests found
...@@ -52,6 +52,10 @@ ...@@ -52,6 +52,10 @@
{'type': 'string', 'default': '', {'type': 'string', 'default': '',
'help': 'all indexable types except given etypes' 'help': 'all indexable types except given etypes'
'[default: []]'}), '[default: []]'}),
('chunksize',
{'type': 'int', 'default': 100000,
'help': 'max number of entities to fetch at once (deafult: 100000)',
}),
] ]
def run(self, args): def run(self, args):
...@@ -94,7 +98,9 @@ ...@@ -94,7 +98,9 @@
if index_name is None: if index_name is None:
index_name = cnx.vreg.config['index-name'] index_name = cnx.vreg.config['index-name']
for etype in etypes: for etype in etypes:
for idx, entity in enumerate(indexable_entities(cnx, etype), 1): for idx, entity in enumerate(
indexable_entities(
cnx, etype, chunksize=self.config.chunksize), 1):
try: try:
serializer = entity.cw_adapt_to('IFullTextIndexSerializable') serializer = entity.cw_adapt_to('IFullTextIndexSerializable')
json = serializer.serialize(complete=False) json = serializer.serialize(complete=False)
......
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