Skip to content

Commit fd54d69

Browse files
committed
fixing command
1 parent faca6de commit fd54d69

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

readthedocs/search/management/commands/reindex_elasticsearch.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,6 @@ def _run_reindex_tasks(self, models):
7272
.format(app_label, model_name, len(instance_ids)))
7373
log.info(message)
7474

75-
@staticmethod
76-
def _get_models(args):
77-
for model_name in args:
78-
yield apps.get_model(model_name)
79-
8075
def add_arguments(self, parser):
8176
parser.add_argument(
8277
'--models',
@@ -88,8 +83,15 @@ def add_arguments(self, parser):
8883
)
8984

9085
def handle(self, *args, **options):
86+
"""
87+
Index models into Elasticsearch index asynchronously using celery.
88+
89+
You can specify model to get indexed by passing
90+
`--model <app_label>.<model_name>` parameter.
91+
Otherwise, it will reindex all the models
92+
"""
9193
models = None
9294
if options['models']:
93-
models = self._get_models(options['models'])
95+
models = [apps.get_model(model_name) for model_name in options['models']]
9496

9597
self._run_reindex_tasks(models=models)

0 commit comments

Comments
 (0)