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

Use new filltext interface for same_source method

parent c3a4442d
......@@ -245,15 +245,11 @@ class UnitManager(models.Manager):
'''
Finds units with same source.
'''
source_string = unit.get_source_plurals()[0]
parser = qparser.QueryParser('source', SOURCE_SCHEMA)
parsed = parser.parse(source_string)
checksums = set()
with FULLTEXT_INDEX.source_searcher() as searcher:
# Search for same string
results = searcher.search(parsed)
for result in results:
checksums.add(result['checksum'])
checksums = fulltext_search(
unit.get_source_plurals()[0],
unit.translation.language.code,
True, False, False
)
return self.filter(
checksum__in=checksums,
......
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