[mob][photos] Remove face IDs that aren't associated with any cluster from getting added to the 'Only them' filter results
This commit is contained in:
@@ -1053,4 +1053,17 @@ class MLDataDB {
|
||||
|
||||
return <String>{for (final row in result) row[clusterIDColumn]};
|
||||
}
|
||||
|
||||
Future<Set<int>> getAllFileIDsOfFaceIDsNotInAnyCluster() async {
|
||||
final db = await instance.asyncDB;
|
||||
final result = await db.getAll(
|
||||
'''
|
||||
SELECT DISTINCT file_id
|
||||
FROM faces
|
||||
LEFT JOIN face_clusters ON faces.face_id = face_clusters.face_id
|
||||
WHERE face_clusters.face_id IS NULL;
|
||||
''',
|
||||
);
|
||||
return <int>{for (final row in result) row[fileIDColumn]};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,6 +103,11 @@ Future<List<EnteFile>> getFilteredFiles(
|
||||
final fileIDsToAvoid =
|
||||
await MLDataDB.instance.getFileIDsOfClusterIDs(clusterIDsToAvoid);
|
||||
|
||||
final filesOfFaceIDsNotInAnyCluster =
|
||||
await MLDataDB.instance.getAllFileIDsOfFaceIDsNotInAnyCluster();
|
||||
|
||||
fileIDsToAvoid.addAll(filesOfFaceIDsNotInAnyCluster);
|
||||
|
||||
final result =
|
||||
intersectionOfSelectedFaceFiltersFileIDs.difference(fileIDsToAvoid);
|
||||
filter.matchedUploadedIDs.addAll(result);
|
||||
|
||||
Reference in New Issue
Block a user