Commit d7323531 authored by Michal Čihař's avatar Michal Čihař

Avoid using distinct here, it is too expensive on database side

parent 3f0d1ea3
...@@ -22,7 +22,7 @@ class Command(BaseCommand): ...@@ -22,7 +22,7 @@ class Command(BaseCommand):
trans.search.create_target_index(lang = lang.code) trans.search.create_target_index(lang = lang.code)
with trans.search.get_source_writer(buffered = False) as writer: with trans.search.get_source_writer(buffered = False) as writer:
for unit in Unit.objects.values('checksum', 'source', 'context', 'translation_id').distinct().iterator(): for unit in Unit.objects.values('checksum', 'source', 'context', 'translation_id').iterator():
Unit.objects.add_to_source_index( Unit.objects.add_to_source_index(
unit['checksum'], unit['checksum'],
unit['source'], unit['source'],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment