fix(sqlite): filter out NULL phash values in FindDuplicates

This commit is contained in:
Slick Daddy 2026-05-03 23:04:59 +03:00
parent 18be6a7607
commit 765a6f6fc4

View file

@ -1437,13 +1437,15 @@ func (qb *SceneStore) FindDuplicates(ctx context.Context, distance int, duration
finalQuery := `
SELECT GROUP_CONCAT(DISTINCT scene_id) as ids
FROM (` + sqlStr + `)
WHERE durationDiff <= ?
OR ? < 0
WHERE phash IS NOT NULL
AND (durationDiff <= ?
OR ? < 0)
GROUP BY phash
HAVING COUNT(phash) > 1
AND COUNT(DISTINCT scene_id) > 1
ORDER BY SUM(file_size) DESC;
`
var ids []string
args := append(query.allArgs(), durationDiff, durationDiff)
if err := dbWrapper.Select(ctx, &ids, finalQuery, args...); err != nil {