From f261ee71848b0db05e17b1b56d3f40b16a12d4a0 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Fri, 5 Apr 2024 18:48:44 +0530 Subject: [PATCH] [mob] Hide smaller clusters only when there are more than 2 clusters --- mobile/ios/Podfile.lock | 2 +- mobile/lib/face/db.dart | 7 ++++++- mobile/lib/services/search_service.dart | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/mobile/ios/Podfile.lock b/mobile/ios/Podfile.lock index 233e4a853f..7d1c2d5b5a 100644 --- a/mobile/ios/Podfile.lock +++ b/mobile/ios/Podfile.lock @@ -496,4 +496,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: c1a8f198a245ed1f10e40b617efdb129b021b225 -COCOAPODS: 1.15.2 +COCOAPODS: 1.14.3 diff --git a/mobile/lib/face/db.dart b/mobile/lib/face/db.dart index 75c516481d..a482f500cf 100644 --- a/mobile/lib/face/db.dart +++ b/mobile/lib/face/db.dart @@ -409,6 +409,9 @@ class FaceMLDataDB { } offset += batchSize; } + _logger.info( + 'done reading face embeddings ${result.length}', + ); return result; } @@ -493,7 +496,8 @@ class FaceMLDataDB { } Future bulkAssignClusterToPersonID( - Map clusterToPersonID,) async { + Map clusterToPersonID, + ) async { final db = await instance.database; final batch = db.batch(); for (final entry in clusterToPersonID.entries) { @@ -505,6 +509,7 @@ class FaceMLDataDB { personIdColumn: personID, cluserIDColumn: clusterID, }, + conflictAlgorithm: ConflictAlgorithm.replace, ); } await batch.commit(noResult: true); diff --git a/mobile/lib/services/search_service.dart b/mobile/lib/services/search_service.dart index 7c7544de28..375fc4d847 100644 --- a/mobile/lib/services/search_service.dart +++ b/mobile/lib/services/search_service.dart @@ -823,7 +823,7 @@ class SearchService { throw Exception( "Cluster $clusterId should not have person id ${clusterIDToPersonID[clusterId]}"); } - if (files.length < 3) { + if (files.length < 3 && sortedClusterIds.length > 3) { continue; } facesResult.add(