Skip to content

Commit

Permalink
Use Quryset.iterator() when generating syllables
Browse files Browse the repository at this point in the history
  • Loading branch information
juuso-j committed Jun 6, 2024
1 parent e2acbbd commit 9023257
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion services/management/commands/index_search_columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def generate_syllables(
qs = model.objects.filter(modified_at__gte=hyphenate_addresses_from)
else:
qs = model.objects.all()
for row in qs:
for row in qs.iterator(chunk_size=10000):
row.syllables_fi = []
for column in model.get_syllable_fi_columns():
row_content = get_foreign_key_attr(row, column)
Expand Down Expand Up @@ -128,6 +128,7 @@ def handle(self, *args, **options):
)
except ValueError as err:
raise ValueError(err)

for lang in ["fi", "sv", "en"]:
key = "search_column_%s" % lang
# Only generate syllables for the finnish language
Expand Down

0 comments on commit 9023257

Please sign in to comment.