Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

documents: fix import document indexing #969

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions sonar/modules/documents/cli/rerodoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -133,6 +131,7 @@ def save_records(ids):

record.commit()
db.session.flush()
record.reindex()
ids.append(str(record.id))

current_app.logger.warning(
Expand Down
3 changes: 1 addition & 2 deletions sonar/modules/documents/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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