π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Speed
Manav Rathi2990ba855f98
diff --git a/web/packages/new/photos/services/search/index.ts b/web/packages/new/photos/services/search/index.tsindex c98416bc53..89d99eef8d 100644--- a/web/packages/new/photos/services/search/index.ts+++ b/web/packages/new/photos/services/search/index.ts@@ -102,19 +102,31 @@ const clipSuggestion = async (return { type: "clip", clipScoreForFileID: matches, label: searchString };};-const suggestionsToOptions = async (suggestions: SearchSuggestion[]) =>- Promise.all(- suggestions.map(async (suggestion) => {- const matchingFiles = await filterSearchableFiles(suggestion);- return matchingFiles.length- ? {- suggestion,- fileCount: matchingFiles.length,- previewFiles: matchingFiles.slice(0, 3),- }- : undefined;- }),- ).then((r) => r.filter((o) => !!o));+// const suggestionsToOptions = async (suggestions: SearchSuggestion[]) =>+// Promise.all(+// suggestions.map(async (suggestion) => {+// const matchingFiles = await filterSearchableFiles(suggestion);+// return matchingFiles.length+// ? {+// suggestion,+// fileCount: matchingFiles.length,+// previewFiles: matchingFiles.slice(0, 3),+// }+// : undefined;+// }),+// ).then((r) => r.filter((o) => !!o));+ const suggestionsToOptions = async (suggestions: SearchSuggestion[]) => {+ const filess = await filterSearchableFiles2(suggestions);+ const f2 = filess.map((f, i) => [f, suggestions[i]!] as const);+ return f2+ .filter(([fs]) => fs.length)+ .map(([f, s]) => ({+ // suggestion: suggestions[i],+ suggestion: s,+ fileCount: f.length,+ previewFiles: f.slice(0, 3),+ }));+ };/*** Return the list of {@link EnteFile}s (from amongst the previously set@@ -123,6 +135,9 @@ const suggestionsToOptions = async (suggestions: SearchSuggestion[]) =>export const filterSearchableFiles = async (suggestion: SearchSuggestion) =>worker().then((w) => w.filterSearchableFiles(suggestion));+export const filterSearchableFiles2 = async (suggestion: SearchSuggestion[]) =>+ worker().then((w) => w.filterSearchableFiles2(suggestion));+/*** Cached value of {@link localizedSearchData}.*/diff --git a/web/packages/new/photos/services/search/worker.ts b/web/packages/new/photos/services/search/worker.tsindex b32bf46439..ffbc118bc6 100644--- a/web/packages/new/photos/services/search/worker.ts+++ b/web/packages/new/photos/services/search/worker.ts@@ -96,6 +96,17 @@ export class SearchWorker {suggestion,);}++ filterSearchableFiles2(suggestions: SearchSuggestion[]) {+ return suggestions.map((suggestion) => {+ return sortMatchesIfNeeded(+ this.searchableData.files.filter((f) =>+ isMatchingFile(f, suggestion),+ ),+ suggestion,+ );+ });+ }}expose(SearchWorker);