From ec566339ade4f6d18532ab6677c555a47ca989b4 Mon Sep 17 00:00:00 2001 From: mertalev <101130780+mertalev@users.noreply.github.com> Date: Wed, 15 Oct 2025 14:57:53 -0400 Subject: [PATCH] minor fixes --- e2e/src/api/specs/server.e2e-spec.ts | 1 + i18n/en.json | 2 +- .../schema/migrations/1758705774125-CreateAssetOCRTable.ts | 3 --- .../schema/migrations/1758705789125-CreateOCRSearchTable.ts | 6 ++++-- web/src/lib/modals/SearchFilterModal.svelte | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/e2e/src/api/specs/server.e2e-spec.ts b/e2e/src/api/specs/server.e2e-spec.ts index c89280f579..1336ec92fb 100644 --- a/e2e/src/api/specs/server.e2e-spec.ts +++ b/e2e/src/api/specs/server.e2e-spec.ts @@ -113,6 +113,7 @@ describe('/server', () => { importFaces: false, oauth: false, oauthAutoLaunch: false, + ocr: true, passwordLogin: true, search: true, sidecar: true, diff --git a/i18n/en.json b/i18n/en.json index e7a3da53ec..f74fe3e982 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -253,9 +253,9 @@ "oauth_storage_quota_claim_description": "Automatically set the user's storage quota to the value of this claim.", "oauth_storage_quota_default": "Default storage quota (GiB)", "oauth_storage_quota_default_description": "Quota in GiB to be used when no claim is provided.", - "ocr_job_description": "Use machine learning to recognize text in images", "oauth_timeout": "Request Timeout", "oauth_timeout_description": "Timeout for requests in milliseconds", + "ocr_job_description": "Use machine learning to recognize text in images", "password_enable_description": "Login with email and password", "password_settings": "Password Login", "password_settings_description": "Manage password login settings", diff --git a/server/src/schema/migrations/1758705774125-CreateAssetOCRTable.ts b/server/src/schema/migrations/1758705774125-CreateAssetOCRTable.ts index 4071e4b04e..611aac8398 100644 --- a/server/src/schema/migrations/1758705774125-CreateAssetOCRTable.ts +++ b/server/src/schema/migrations/1758705774125-CreateAssetOCRTable.ts @@ -12,8 +12,5 @@ export async function up(db: Kysely): Promise { } export async function down(db: Kysely): Promise { - await sql`DROP INDEX "asset_ocr_assetId_idx";`.execute(db); - await sql`ALTER TABLE "asset_ocr" DROP CONSTRAINT "asset_ocr_pkey";`.execute(db); - await sql`ALTER TABLE "asset_ocr" DROP CONSTRAINT "asset_ocr_assetId_fkey";`.execute(db); await sql`DROP TABLE "asset_ocr";`.execute(db); } diff --git a/server/src/schema/migrations/1758705789125-CreateOCRSearchTable.ts b/server/src/schema/migrations/1758705789125-CreateOCRSearchTable.ts index 47cd23e17e..1b3eefd57d 100644 --- a/server/src/schema/migrations/1758705789125-CreateOCRSearchTable.ts +++ b/server/src/schema/migrations/1758705789125-CreateOCRSearchTable.ts @@ -9,10 +9,12 @@ export async function up(db: Kysely): Promise { await sql`CREATE INDEX "idx_ocr_search_text" ON "ocr_search" USING gin (f_unaccent("text") gin_trgm_ops);`.execute( db, ); + await sql`INSERT INTO "migration_overrides" ("name", "value") VALUES ('index_idx_ocr_search_text', '{"type":"index","name":"idx_ocr_search_text","sql":"CREATE INDEX \\"idx_ocr_search_text\\" ON \\"ocr_search\\" USING gin (f_unaccent(\\"text\\") gin_trgm_ops);"}'::jsonb);`.execute( + db, + ); } export async function down(db: Kysely): Promise { - await sql`ALTER TABLE "ocr_search" DROP CONSTRAINT "ocr_search_pkey";`.execute(db); - await sql`ALTER TABLE "ocr_search" DROP CONSTRAINT "ocr_search_assetId_fkey";`.execute(db); await sql`DROP TABLE "ocr_search";`.execute(db); + await sql`DELETE FROM "migration_overrides" WHERE "name" = 'index_idx_ocr_search_text';`.execute(db); } diff --git a/web/src/lib/modals/SearchFilterModal.svelte b/web/src/lib/modals/SearchFilterModal.svelte index d97af613e2..6afc4cd07c 100644 --- a/web/src/lib/modals/SearchFilterModal.svelte +++ b/web/src/lib/modals/SearchFilterModal.svelte @@ -6,7 +6,7 @@ export type SearchFilter = { query: string; - ocr: string; + ocr?: string; queryType: 'smart' | 'metadata' | 'description' | 'ocr'; personIds: SvelteSet; tagIds: SvelteSet | null; @@ -75,7 +75,7 @@ let filter: SearchFilter = $state({ query, - ocr: 'ocr' in searchQuery ? searchQuery.ocr : '', + ocr: searchQuery.ocr, queryType: defaultQueryType(), personIds: new SvelteSet('personIds' in searchQuery ? searchQuery.personIds : []), tagIds: @@ -114,7 +114,7 @@ const resetForm = () => { filter = { query: '', - ocr: '', + ocr: undefined, queryType: defaultQueryType(), // retain from localStorage or default personIds: new SvelteSet(), tagIds: new SvelteSet(),