From e40d098b31edc2bfd68852577f92c1f1bd2485e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Marie=CC=81thoz?= Date: Tue, 9 Jan 2024 07:30:05 +0100 Subject: [PATCH] documents: fix import document indexing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bulk index does not take into account a specific record class, thus the dumpers are not used. A non bulk indexing is used instead. Co-authored-by: Johnny MarieĢthoz --- sonar/modules/documents/cli/rerodoc.py | 3 +-- sonar/modules/documents/tasks.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/sonar/modules/documents/cli/rerodoc.py b/sonar/modules/documents/cli/rerodoc.py index f1418e44..95132ec9 100644 --- a/sonar/modules/documents/cli/rerodoc.py +++ b/sonar/modules/documents/cli/rerodoc.py @@ -55,8 +55,6 @@ def save_records(ids): :param ids: List of records to save """ db.session.commit() - indexer.bulk_index(ids) - indexer.process_bulk_queue() try: with open(permissions_file.name, 'r') as file: @@ -133,6 +131,7 @@ def save_records(ids): record.commit() db.session.flush() + record.reindex() ids.append(str(record.id)) current_app.logger.warning( diff --git a/sonar/modules/documents/tasks.py b/sonar/modules/documents/tasks.py index 19e8365d..b57d5009 100644 --- a/sonar/modules/documents/tasks.py +++ b/sonar/modules/documents/tasks.py @@ -84,6 +84,7 @@ def import_records(records_to_import): # Pushing record to database, not yet persisted into DB db.session.flush() + record.reindex() # Add ID for bulk index in elasticsearch ids.append(str(record.id)) @@ -99,7 +100,5 @@ def import_records(records_to_import): # Commit and index records db.session.commit() - indexer.bulk_index(ids) - indexer.process_bulk_queue() return ids