Skip to content

armgit / ente

Public Imported from GitHub
0

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

add logs to getAllPeopleSuggestion and getIndexStatusSuggestion

Abhinave7ba94bdbd58
diff --git a/apps/photos/src/services/searchService.ts b/apps/photos/src/services/searchService.ts
index fed967b04a..86e63c2d18 100644
--- a/apps/photos/src/services/searchService.ts
+++ b/apps/photos/src/services/searchService.ts
@@ -42,7 +42,7 @@ export const getDefaultOptions = async (files: EnteFile[]) => {
return [
await getIndexStatusSuggestion(),
...convertSuggestionsToOptions(await getAllPeopleSuggestion(), files),
- ];
+ ].filter((t) => !!t);
};
export const getAutoCompleteSuggestions =
@@ -176,7 +176,9 @@ function getYearSuggestion(searchPhrase: string): Suggestion[] {
export async function getAllPeopleSuggestion(): Promise<Array<Suggestion>> {
try {
+ addLogLine('getAllPeopleSuggestion called');
const people = await getAllPeople(200);
+ addLogLine(`found people: ${people?.length ?? 0}`);
return people.map((person) => ({
label: person.name,
type: SuggestionType.PERSON,
@@ -190,28 +192,32 @@ export async function getAllPeopleSuggestion(): Promise<Array<Suggestion>> {
}
export async function getIndexStatusSuggestion(): Promise<Suggestion> {
- const config = await getMLSyncConfig();
- const indexStatus = await mlIDbStorage.getIndexStatus(config.mlVersion);
-
- let label;
- if (!indexStatus.localFilesSynced) {
- label = t('INDEXING_SCHEDULED');
- } else if (indexStatus.outOfSyncFilesExists) {
- label = t('ANALYZING_PHOTOS', {
- indexStatus,
- });
- } else if (!indexStatus.peopleIndexSynced) {
- label = t('INDEXING_PEOPLE', { indexStatus });
- } else {
- label = t('INDEXING_DONE', { indexStatus });
- }
+ try {
+ const config = await getMLSyncConfig();
+ const indexStatus = await mlIDbStorage.getIndexStatus(config.mlVersion);
+
+ let label;
+ if (!indexStatus.localFilesSynced) {
+ label = t('INDEXING_SCHEDULED');
+ } else if (indexStatus.outOfSyncFilesExists) {
+ label = t('ANALYZING_PHOTOS', {
+ indexStatus,
+ });
+ } else if (!indexStatus.peopleIndexSynced) {
+ label = t('INDEXING_PEOPLE', { indexStatus });
+ } else {
+ label = t('INDEXING_DONE', { indexStatus });
+ }
- return {
- label,
- type: SuggestionType.INDEX_STATUS,
- value: indexStatus,
- hide: true,
- };
+ return {
+ label,
+ type: SuggestionType.INDEX_STATUS,
+ value: indexStatus,
+ hide: true,
+ };
+ } catch (e) {
+ logError(e, 'getIndexStatusSuggestion failed');
+ }
}
function getDateSuggestion(searchPhrase: string): Suggestion[] {