π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
To new
Manav Rathi5b2be09a6a44
diff --git a/web/packages/new/photos/services/search/index.ts b/web/packages/new/photos/services/search/index.tsindex 25bdf5ce42..eb84ce3b33 100644--- a/web/packages/new/photos/services/search/index.ts+++ b/web/packages/new/photos/services/search/index.ts@@ -166,7 +166,10 @@ const labelledFileTypes = (): LabelledFileType[] => [export const getAutoCompleteSuggestions =(files: EnteFile[], collections: Collection[]) =>async (searchPhrase: string): Promise<SearchOption[]> => {- log.debug(() => ["getAutoCompleteSuggestions", { searchPhrase }]);+ log.debug(() => [+ "getAutoCompleteSuggestions",+ { searchPhrase, collections },+ ]);try {const searchPhrase2 = searchPhrase.trim().toLowerCase();// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition@@ -180,7 +183,6 @@ export const getAutoCompleteSuggestions =// - getLocationSuggestion(searchPhrase),// - getFileTypeSuggestion(searchPhrase),...(await createSearchQuery(searchPhrase)),- ...getCollectionSuggestion(searchPhrase2, collections),getFileNameSuggestion(searchPhrase2, files),getFileCaptionSuggestion(searchPhrase2, files),// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition@@ -219,22 +221,6 @@ async function convertSuggestionsToOptions(return previewImageAppendedOptions;}-function getCollectionSuggestion(- searchPhrase: string,- collections: Collection[],-): Suggestion[] {- const collectionResults = searchCollection(searchPhrase, collections);-- return collectionResults.map(- (searchResult) =>- ({- type: SuggestionType.COLLECTION,- value: searchResult.id,- label: searchResult.name,- }) as Suggestion,- );-}-function getFileNameSuggestion(searchPhrase: string,files: EnteFile[],diff --git a/web/packages/new/photos/services/search/worker.ts b/web/packages/new/photos/services/search/worker.tsindex 8b3c57dce9..d45c85bf24 100644--- a/web/packages/new/photos/services/search/worker.ts+++ b/web/packages/new/photos/services/search/worker.ts@@ -1,5 +1,6 @@import { HTTPError } from "@/base/http";import type { Location } from "@/base/types";+import type { Collection } from "@/media/collection";import { fileCreationPhotoDate, fileLocation } from "@/media/file-metadata";import type { EnteFile } from "@/new/photos/types/file";import { nullToUndefined } from "@/utils/transform";@@ -73,6 +74,7 @@ export class SearchWorker {createSearchQuery(s: string, localizedSearchData: LocalizedSearchData) {return createSearchQuery(s,+ this.searchableData,localizedSearchData,this.locationTags,this.cities,@@ -93,16 +95,27 @@ expose(SearchWorker);const createSearchQuery = (s: string,+ { collections }: SearchableData,{ locale, holidays, labelledFileTypes }: LocalizedSearchData,locationTags: Searchable<LocationTag>[],cities: Searchable<City>[],): Suggestion[] =>[+ collectionSuggestions(s, collections),dateSuggestions(s, locale, holidays),locationSuggestions(s, locationTags, cities),fileTypeSuggestions(s, labelledFileTypes),].flat();+const collectionSuggestions = (s: string, collections: Collection[]) =>+ collections+ .filter(({ name }) => name.toLowerCase().includes(s))+ .map(({ id, name }) => ({+ type: SuggestionType.COLLECTION,+ value: id,+ label: name,+ }));+const dateSuggestions = (s: string,locale: string,