From 939f17add2bc945367cbeae8f392aff1c127ba9a Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Tue, 11 May 2021 20:59:55 +0200 Subject: [PATCH] Make the Persons cache distinct on the MediaEntry --- src/backend/model/database/sql/IndexingManager.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backend/model/database/sql/IndexingManager.ts b/src/backend/model/database/sql/IndexingManager.ts index 649cf6bf..e0d9eab5 100644 --- a/src/backend/model/database/sql/IndexingManager.ts +++ b/src/backend/model/database/sql/IndexingManager.ts @@ -228,7 +228,8 @@ export class IndexingManager implements IIndexingManager { const scannedFaces = (media[i].metadata as PhotoMetadata).faces || []; if ((media[i].metadata as PhotoMetadata).faces) { // if it has faces, cache them - (media[i].metadata as PhotoMetadataEntity).persons = (media[i].metadata as PhotoMetadata).faces.map(f => f.name); + // make the list distinct (some photos may contain the same person multiple times) + (media[i].metadata as PhotoMetadataEntity).persons = [...new Set((media[i].metadata as PhotoMetadata).faces.map(f => f.name))]; } delete (media[i].metadata as PhotoMetadata).faces; // this is a separated DB, lets save separately