feat(backend): report stored pairwise distances in the duplicates response

ListVisible already loads each pair's Hamming distance, but clusterPairs threw
it away. Thread it through: Clusters now returns a Cluster carrying the stored
pairwise distances (indexed once per page), and the list endpoint emits them as
{a, b, distance}. Pairs linked only transitively have no stored distance and are
omitted. Lets the UI show how close each file is to the kept one without a
client-side hash compare (phash exceeds JS's safe-integer range).
This commit is contained in:
2026-06-22 22:42:14 +03:00
parent 281358ff04
commit 78b5e86dd6
5 changed files with 91 additions and 9 deletions
+22
View File
@@ -1956,6 +1956,28 @@ components:
description: Two or more mutually similar files
items:
$ref: '#/components/schemas/File'
distances:
type: array
description: >-
Stored perceptual-hash (Hamming) distances between pairs of files in
the cluster. A pair linked only transitively (through an intermediate
file) has no stored distance and is omitted.
items:
$ref: '#/components/schemas/DuplicatePairDistance'
DuplicatePairDistance:
type: object
required: [a, b, distance]
properties:
a:
type: string
format: uuid
b:
type: string
format: uuid
distance:
type: integer
description: Hamming distance (064) between the two files' perceptual hashes
DuplicateClusterPage:
type: object