Skip to content

armgit / ente

Public Imported from GitHub
0

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

Add support to search by uploader name

Neeraj Gupta4500a8f620d7
diff --git a/mobile/lib/models/search/search_types.dart b/mobile/lib/models/search/search_types.dart
index 25ee531ad9..db2c9be797 100644
--- a/mobile/lib/models/search/search_types.dart
+++ b/mobile/lib/models/search/search_types.dart
@@ -26,6 +26,7 @@ import "package:photos/utils/share_util.dart";
enum ResultType {
collection,
file,
+ uploader,
location,
locationSuggestion,
month,
diff --git a/mobile/lib/services/search_service.dart b/mobile/lib/services/search_service.dart
index b68a597916..ea990e02e4 100644
--- a/mobile/lib/services/search_service.dart
+++ b/mobile/lib/services/search_service.dart
@@ -551,6 +551,7 @@ class SearchService {
final List<EnteFile> allFiles = await getAllFilesForSearch();
final List<EnteFile> captionMatch = <EnteFile>[];
final List<EnteFile> displayNameMatch = <EnteFile>[];
+ final List<EnteFile> uploaderNameMatch = <EnteFile>[];
for (EnteFile eachFile in allFiles) {
if (eachFile.caption != null && pattern.hasMatch(eachFile.caption!)) {
captionMatch.add(eachFile);
@@ -558,6 +559,10 @@ class SearchService {
if (pattern.hasMatch(eachFile.displayName)) {
displayNameMatch.add(eachFile);
}
+ if (eachFile.uploaderName != null &&
+ pattern.hasMatch(eachFile.uploaderName!)) {
+ uploaderNameMatch.add(eachFile);
+ }
}
if (captionMatch.isNotEmpty) {
searchResults.add(
@@ -590,6 +595,21 @@ class SearchService {
),
);
}
+ if (uploaderNameMatch.isNotEmpty) {
+ searchResults.add(
+ GenericSearchResult(
+ ResultType.uploader,
+ query,
+ uploaderNameMatch,
+ hierarchicalSearchFilter: TopLevelGenericFilter(
+ filterName: query,
+ occurrence: kMostRelevantFilter,
+ filterResultType: ResultType.uploader,
+ matchedUploadedIDs: filesToUploadedFileIDs(uploaderNameMatch),
+ ),
+ ),
+ );
+ }
return searchResults;
}