From b17acc0effc787c458a60b8d354a4050a801d55f Mon Sep 17 00:00:00 2001 From: Sny Date: Sat, 30 Dec 2023 11:23:21 +0530 Subject: [PATCH] OpenConceptLab/ocl_issues#957 | ES batch indexes | extract doc --- core/common/models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/common/models.py b/core/common/models.py index 11e17b3ff..d650e9986 100644 --- a/core/common/models.py +++ b/core/common/models.py @@ -179,11 +179,12 @@ def get_exact_or_criteria(attr, values): @staticmethod def batch_index(queryset, document, single_batch=False): if not get(settings, 'TEST_MODE'): + doc = document() if single_batch or not get(settings, 'DB_CURSOR_ON', True): - document().update(queryset.all(), parallel=True) + doc.update(queryset.all(), parallel=True) else: for batch in queryset.iterator(chunk_size=500): - document().update(batch, parallel=True) + doc.update(batch, parallel=True) @staticmethod @transaction.atomic