Skip to content

Commit

Permalink
cli: run command accepts a new parameter 'chunk_size'
Browse files Browse the repository at this point in the history
  • Loading branch information
psaiz committed Oct 18, 2024
1 parent 6a6515e commit 0ee6229
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions invenio_indexer/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,16 @@ def resultcallback(group):
default=True,
help="Controls if the search engine bulk indexing errors raise an exception.",
)
@click.option(
"--chunk_size",
default=500,
type=int,
help="Number of documents to send per batch.",
)
@with_appcontext
def run(delayed, concurrency, version_type=None, queue=None, raise_on_error=True):
def run(
delayed, concurrency, chunk_size, version_type=None, queue=None, raise_on_error=True
):
"""Run bulk record indexing."""
if delayed:
celery_kwargs = {
Expand All @@ -77,7 +85,10 @@ def run(delayed, concurrency, version_type=None, queue=None, raise_on_error=True
else:
click.secho("Indexing records...", fg="green")
RecordIndexer(version_type=version_type).process_bulk_queue(
search_bulk_kwargs={"raise_on_error": raise_on_error}
search_bulk_kwargs={
"raise_on_error": raise_on_error,
"chunk_size": chunk_size,
}
)


Expand Down

0 comments on commit 0ee6229

Please sign in to comment.