feat(fuzzy-match): sort results by similarity score descending

Most similar pairs now appear at the top of the table.
Removed the unused __lt__ on _WorkResult (no longer needed).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Trenton H
2026-04-15 07:38:18 -07:00
parent da9e81f111
commit 9f264114ab
@@ -27,9 +27,6 @@ class _WorkResult:
doc_two_pk: int
ratio: float
def __lt__(self, other: "_WorkResult") -> bool:
return self.doc_one_pk < other.doc_one_pk
def _process_and_match(work: _WorkPackage) -> _WorkResult:
"""
@@ -206,7 +203,7 @@ class Command(PaperlessCommand):
):
yield proc_result.result
matches = sorted(_iter_matches())
matches = sorted(_iter_matches(), key=lambda m: m.ratio, reverse=True)
maybe_delete_ids = self._render_results(
matches,
opt_ratio=opt_ratio,