Skip to content

armgit / ente

Public Imported from GitHub
0

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

People b4 clip

Manav Rathi00ffe8f12927
diff --git a/web/packages/new/photos/services/search/index.ts b/web/packages/new/photos/services/search/index.ts
index 4cee3026f2..5a13e77768 100644
--- a/web/packages/new/photos/services/search/index.ts
+++ b/web/packages/new/photos/services/search/index.ts
@@ -88,13 +88,13 @@ const suggestionsForString = async (searchString: string) => {
// The CLIP matching code already runs in the ML worker, so let that run
// separately, in parallel with the rest of the search query construction in
// the search worker, then combine the two.
- const results = await Promise.all([
+ const [clip, [restPre, restPost]] = await Promise.all([
clipSuggestion(s, searchString).then((s) => s ?? []),
worker().then((w) =>
w.suggestionsForString(s, searchString, localizedSearchData()),
),
]);
- return results.flat();
+ return [restPre, clip, restPost].flat();
};
const clipSuggestion = async (
diff --git a/web/packages/new/photos/services/search/worker.ts b/web/packages/new/photos/services/search/worker.ts
index 58bc3bf553..ba8ba03515 100644
--- a/web/packages/new/photos/services/search/worker.ts
+++ b/web/packages/new/photos/services/search/worker.ts
@@ -135,17 +135,18 @@ const suggestionsForString = (
{ locale, holidays, labelledFileTypes }: LocalizedSearchData,
locationTags: Searchable<LocationTag>[],
cities: Searchable<City>[],
-): SearchSuggestion[] =>
+): [SearchSuggestion[], SearchSuggestion[]] => [
+ [peopleSuggestions(s, searchablePeople)].flat(),
+ // . <-- clip suggestions will be inserted here by our caller.
[
- // . <-- clip suggestions will be inserted here by our caller.
- peopleSuggestions(s, searchablePeople),
fileTypeSuggestions(s, labelledFileTypes),
dateSuggestions(s, locale, holidays),
locationSuggestions(s, locationTags, cities),
collectionSuggestions(s, collections),
fileNameSuggestion(s, searchString, files),
fileCaptionSuggestion(s, searchString, files),
- ].flat();
+ ].flat(),
+];
const collectionSuggestions = (
s: string,