Skip to content

armgit / ente

Public Imported from GitHub
0

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

Place

Manav Rathi1521971a5d8b
diff --git a/web/packages/new/photos/services/search/worker.ts b/web/packages/new/photos/services/search/worker.ts
index 2061014580..de8ae76ca5 100644
--- a/web/packages/new/photos/services/search/worker.ts
+++ b/web/packages/new/photos/services/search/worker.ts
@@ -28,6 +28,8 @@ import type {
SearchSuggestion,
} from "./types";
+type SearchableCGroup = Searchable<Omit<CGroup, "name"> & { name: string }>;
+
/**
* A web worker that runs the search asynchronously so that the main thread
* remains responsive.
@@ -39,9 +41,7 @@ export class SearchWorker {
collections: [],
files: [],
};
- private searchableCGroups: Searchable<
- Omit<CGroup, "name"> & { name: string }
- >[] = [];
+ private searchableCGroups: SearchableCGroup[] = [];
/**
* Fetch any state we might need when the actual search happens.
@@ -102,6 +102,7 @@ export class SearchWorker {
s,
searchString,
this.searchableCollectionsAndFiles,
+ this.searchableCGroups,
localizedSearchData,
this.locationTags,
this.cities,
@@ -139,12 +140,14 @@ const suggestionsForString = (
s: string,
searchString: string,
{ collections, files }: SearchableCollectionsAndFiles,
+ searchableCGroups: SearchableCGroup[],
{ locale, holidays, labelledFileTypes }: LocalizedSearchData,
locationTags: Searchable<LocationTag>[],
cities: Searchable<City>[],
): SearchSuggestion[] =>
[
- // <-- caption suggestions will be inserted here by our caller.
+ // . <-- clip suggestions will be inserted here by our caller.
+ peopleSuggestions(s, searchableCGroups),
fileTypeSuggestions(s, labelledFileTypes),
dateSuggestions(s, locale, holidays),
locationSuggestions(s, locationTags, cities),
@@ -211,6 +214,24 @@ const fileCaptionSuggestion = (
: [];
};
+const peopleSuggestions = (
+ s: string,
+ searchableCGroups: SearchableCGroup[],
+): SearchSuggestion[] => {
+ // Suppress the unused warning during WIP
+ if (process.env.NEXT_PUBLIC_ENTE_WIP_CL) {
+ console.log({ s, searchableCGroups });
+ }
+ return [];
+ // searchableCGroups
+ // .filter(({ lowercasedName }) => lowercasedName.startsWith(s))
+ // .map((scgroup) => ({
+ // type: "person",
+ // person: scgroup,
+ // label: scgroup.name,
+ // }));
+};
+
const dateSuggestions = (
s: string,
locale: string,