π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Remove descriptions that have connect words as all of it's words
ashilkn93dd5352266b
diff --git a/lib/core/constants.dart b/lib/core/constants.dartindex 7f6d59865a..b310a445b3 100644--- a/lib/core/constants.dart+++ b/lib/core/constants.dart@@ -53,7 +53,7 @@ const double restrictedMaxWidth = 430;const double mobileSmallThreshold = 336;// Note: 0 indicates no device limit-const publicLinkDeviceLimits = [0,50, 25, 10, 5, 2, 1];+const publicLinkDeviceLimits = [0, 50, 25, 10, 5, 2, 1];const kilometersPerDegree = 111.16;diff --git a/lib/extensions/string_ext.dart b/lib/extensions/string_ext.dartindex 09d61f59b7..e97ce46fe4 100644--- a/lib/extensions/string_ext.dart+++ b/lib/extensions/string_ext.dart@@ -1,3 +1,27 @@+const List<String> connectWords = [+ 'a', 'an', 'the', // Articles++ 'about', 'above', 'across', 'after', 'against', 'along', 'amid', 'among',+ 'around', 'as', 'at', 'before', 'behind', 'below', 'beneath', 'beside',+ 'between', 'beyond', 'by', 'concerning', 'considering', 'despite', 'down',+ 'during', 'except', 'for', 'from', 'in', 'inside', 'into', 'like', 'near',+ 'of', 'off', 'on', 'onto', 'out', 'outside', 'over', 'past', 'regarding',+ 'round', 'since', 'through', 'to', 'toward', 'under', 'underneath', 'until',+ 'unto', 'up', 'upon', 'with', 'within', 'without', // Prepositions++ 'and', 'as', 'because', 'but', 'for', 'if', 'nor', 'or', 'since', 'so',+ 'that', 'though', 'unless', 'until', 'when', 'whenever', 'where', 'whereas',+ 'wherever', 'while', 'yet', // Conjunctions++ 'i', 'you', 'he', 'she', 'it', 'we', 'they', 'me', 'him', 'her', 'us', 'them',+ 'my', 'your', 'his', 'its', 'our', 'their', 'mine', 'yours', 'hers', 'ours',+ 'theirs', 'who', 'whom', 'whose', 'which', 'what', // Pronouns++ 'am', 'is', 'are', 'was', 'were', 'be', 'being', 'been', 'have', 'has', 'had',+ 'do', 'does', 'did', 'will', 'would', 'shall', 'should', 'can', 'could',+ 'may', 'might', 'must', // Auxiliary Verbs+];+extension StringExtensionsNullSafe on String? {int get sumAsciiValues {if (this == null) {@@ -10,3 +34,18 @@ extension StringExtensionsNullSafe on String? {return sum;}}++/// If all words in the string are connect words, true is returned and else false+extension DescriptionString on String? {+ bool get isAllConnectWords {+ if (this == null) {+ throw AssertionError("String cannot be null");+ }+ final subDescWords = this!.split(" ");+ return subDescWords.every(+ (subDescWord) => connectWords.any(+ (connectWord) => subDescWord.toLowerCase() == connectWord,+ ),+ );+ }+}diff --git a/lib/services/search_service.dart b/lib/services/search_service.dartindex c50b3945c1..63de31d1ba 100644--- a/lib/services/search_service.dart+++ b/lib/services/search_service.dart@@ -6,6 +6,7 @@ import 'package:photos/data/months.dart';import 'package:photos/data/years.dart';import 'package:photos/db/files_db.dart';import 'package:photos/events/local_photos_updated_event.dart';+import "package:photos/extensions/string_ext.dart";import 'package:photos/models/collection/collection.dart';import 'package:photos/models/collection/collection_items.dart';import 'package:photos/models/file/file.dart';@@ -290,6 +291,8 @@ class SearchService {for (String subDescription in orderedSubDescription[0]!) {if (file.caption!.contains(subDescription)) {matchesSingleWordSubString = true;+ if (subDescription.isAllConnectWords) continue;+if (descriptionAndMatchingFiles.containsKey(subDescription)) {descriptionAndMatchingFiles[subDescription]!.add(file);} else {@@ -299,6 +302,8 @@ class SearchService {}if (matchesSingleWordSubString) {for (String subDescription in orderedSubDescription[1]!) {+ if (subDescription.isAllConnectWords) continue;+if (file.caption!.contains(subDescription)) {if (descriptionAndMatchingFiles.containsKey(subDescription)) {descriptionAndMatchingFiles[subDescription]!.add(file);