Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Lower cluster size threshold on discover page

laurenspriem8079d44c6807
diff --git a/mobile/apps/photos/lib/models/search/search_types.dart b/mobile/apps/photos/lib/models/search/search_types.dart
index 7ee4961899..9ea97cbe82 100644
--- a/mobile/apps/photos/lib/models/search/search_types.dart
+++ b/mobile/apps/photos/lib/models/search/search_types.dart
@@ -14,6 +14,7 @@ import "package:photos/models/collection/collection_items.dart";
import "package:photos/models/search/search_result.dart";
import "package:photos/models/typedefs.dart";
import "package:photos/services/collections_service.dart";
+import "package:photos/services/machine_learning/face_ml/face_filtering/face_filtering_constants.dart";
import "package:photos/services/search_service.dart";
import "package:photos/ui/viewer/gallery/collection_page.dart";
import "package:photos/ui/viewer/location/add_location_sheet.dart";
@@ -220,7 +221,12 @@ extension SectionTypeExtensions on SectionType {
}) {
switch (this) {
case SectionType.face:
- return SearchService.instance.getAllFace(limit);
+ return SearchService.instance.getAllFace(
+ limit,
+ minClusterSize: limit == null
+ ? kMinimumClusterSizeAllFaces
+ : kMinimumClusterSizeSearchResult,
+ );
case SectionType.magic:
return SearchService.instance.getMagicSectionResults(context!);
case SectionType.location:
diff --git a/mobile/apps/photos/lib/services/search_service.dart b/mobile/apps/photos/lib/services/search_service.dart
index 735c2853d1..86a403694f 100644
--- a/mobile/apps/photos/lib/services/search_service.dart
+++ b/mobile/apps/photos/lib/services/search_service.dart
@@ -46,7 +46,6 @@ import 'package:photos/services/collections_service.dart';
import "package:photos/services/date_parse_service.dart";
import "package:photos/services/filter/db_filters.dart";
import "package:photos/services/location_service.dart";
-import "package:photos/services/machine_learning/face_ml/face_filtering/face_filtering_constants.dart";
import "package:photos/services/machine_learning/face_ml/person/person_service.dart";
import 'package:photos/services/machine_learning/semantic_search/semantic_search_service.dart';
import "package:photos/services/memories_cache_service.dart";
@@ -725,7 +724,7 @@ class SearchService {
Future<List<GenericSearchResult>> getAllFace(
int? limit, {
- int minClusterSize = kMinimumClusterSizeSearchResult,
+ required int minClusterSize,
}) async {
try {
debugPrint("getting faces");
@@ -894,13 +893,7 @@ class SearchService {
),
);
}
- if (facesResult.isEmpty) {
- if (kMinimumClusterSizeAllFaces < minClusterSize) {
- return getAllFace(limit, minClusterSize: kMinimumClusterSizeAllFaces);
- } else {
- return [];
- }
- }
+ if (facesResult.isEmpty) return [];
if (limit != null) {
return facesResult.sublist(0, min(limit, facesResult.length));
} else {
diff --git a/mobile/apps/photos/lib/ui/viewer/search/search_widget.dart b/mobile/apps/photos/lib/ui/viewer/search/search_widget.dart
index 0bf9019d96..159b8ccf23 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/search_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/search_widget.dart
@@ -252,7 +252,7 @@ class SearchWidgetState extends State<SearchWidget> {
},
);
- _searchService.getAllFace(null).then(
+ _searchService.getAllFace(null, minClusterSize: 10).then(
(faceResult) {
final List<GenericSearchResult> filteredResults = [];
for (final result in faceResult) {