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

Always use matching source string

parent f1471d55
...@@ -366,10 +366,16 @@ class UnitManager(models.Manager): ...@@ -366,10 +366,16 @@ class UnitManager(models.Manager):
if len(results) == 0: if len(results) == 0:
return self.none() return self.none()
first_hit = results[0] first_hit = results[0]
try:
unit = self.filter(checksum=first_hit['checksum'])[0]
except Exception as error:
weblate.logger.error('failed more like this: %s', str(error))
return self.none()
# Find similar results to first one # Find similar results to first one
more_results = first_hit.more_like_this( more_results = first_hit.more_like_this(
'source', 'source',
source_string, unit.get_source_plurals()[0],
top top
) )
# Include all more like this results # Include all more like this results
......
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