From 173b47033a8d5910c2d46e8ed4252eaf206d27ec Mon Sep 17 00:00:00 2001 From: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> Date: Wed, 21 Feb 2024 16:52:38 +0100 Subject: [PATCH] fix(server): search with same face multiple times (#7306) --- server/src/infra/infra.utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/infra/infra.utils.ts b/server/src/infra/infra.utils.ts index 1538958e0f..745f5a38ff 100644 --- a/server/src/infra/infra.utils.ts +++ b/server/src/infra/infra.utils.ts @@ -213,9 +213,9 @@ export function searchAssetBuilder( if (personIds && personIds.length > 0) { builder .leftJoin(`${builder.alias}.faces`, 'faces') - .andWhere('faces.personId IN (:...personIds)', { personIds: personIds }) + .andWhere('faces.personId IN (:...personIds)', { personIds }) .addGroupBy(`${builder.alias}.id`) - .having('COUNT(faces.id) = :personCount', { personCount: personIds.length }); + .having('COUNT(DISTINCT faces.personId) = :personCount', { personCount: personIds.length }); if (withExif) { builder.addGroupBy('exifInfo.assetId');