diff --git a/server/src/infra/entities/asset.entity.ts b/server/src/infra/entities/asset.entity.ts index 7335c3ddf7..96438a07df 100644 --- a/server/src/infra/entities/asset.entity.ts +++ b/server/src/infra/entities/asset.entity.ts @@ -35,7 +35,7 @@ export const ASSET_CHECKSUM_CONSTRAINT = 'UQ_assets_owner_library_checksum'; @Index('IDX_day_of_month', { synchronize: false }) @Index('IDX_month', { synchronize: false }) @Index('IDX_originalPath_libraryId', ['originalPath', 'libraryId']) -@Index('idx_originalpath_trigram', { synchronize: false }) +@Index('idx_originalFileName_trigram', { synchronize: false }) // For all assets, each originalpath must be unique per user and library export class AssetEntity { @PrimaryGeneratedColumn('uuid') diff --git a/server/src/infra/infra.utils.ts b/server/src/infra/infra.utils.ts index 652bced6b6..636d78ab70 100644 --- a/server/src/infra/infra.utils.ts +++ b/server/src/infra/infra.utils.ts @@ -159,12 +159,12 @@ export function searchAssetBuilder( builder.andWhere(`${builder.alias}.ownerId IN (:...userIds)`, { userIds: options.userIds }); } - const path = _.pick(options, ['encodedVideoPath', 'originalFileName', 'resizePath', 'webpPath']); + const path = _.pick(options, ['encodedVideoPath', 'originalPath', 'resizePath', 'webpPath']); builder.andWhere(_.omitBy(path, _.isUndefined)); - if (options.originalPath) { - builder.andWhere(`f_unaccent(${builder.alias}.originalPath) ILIKE f_unaccent(:originalPath)`, { - originalPath: `%${options.originalPath}%`, + if (options.originalFileName) { + builder.andWhere(`f_unaccent(${builder.alias}.originalFileName) ILIKE f_unaccent(:originalFileName)`, { + originalFileName: `%${options.originalFileName}%`, }); } diff --git a/server/src/infra/migrations/1709608140355-AddAssetOriginalPathTrigramIndex.ts b/server/src/infra/migrations/1709608140355-AddAssetOriginalPathTrigramIndex.ts index fdca15cbff..1d4f13410a 100644 --- a/server/src/infra/migrations/1709608140355-AddAssetOriginalPathTrigramIndex.ts +++ b/server/src/infra/migrations/1709608140355-AddAssetOriginalPathTrigramIndex.ts @@ -3,12 +3,12 @@ import { MigrationInterface, QueryRunner } from 'typeorm'; export class AddAssetOriginalPathTrigramIndex1709608140355 implements MigrationInterface { public async up(queryRunner: QueryRunner): Promise { await queryRunner.query(` - CREATE INDEX idx_originalpath_trigram + CREATE INDEX idx_originalFileName_trigram ON assets - USING gin (f_unaccent("originalPath") gin_trgm_ops)`); + USING gin (f_unaccent("originalFileName") gin_trgm_ops)`); } public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(`DROP INDEX "idx_originalpath_trigram"`); + await queryRunner.query(`DROP INDEX "idx_originalFileName_trigram"`); } } diff --git a/web/src/lib/components/shared-components/search-bar/search-filter-box.svelte b/web/src/lib/components/shared-components/search-bar/search-filter-box.svelte index d81ed566ca..b921f2bfd7 100644 --- a/web/src/lib/components/shared-components/search-bar/search-filter-box.svelte +++ b/web/src/lib/components/shared-components/search-bar/search-filter-box.svelte @@ -94,7 +94,7 @@ let payload: SmartSearchDto | MetadataSearchDto = { query: filter.context || undefined, - originalPath: filter.filename, + originalFileName: filter.filename, country: filter.location.country, state: filter.location.state, city: filter.location.city, diff --git a/web/src/routes/(user)/search/+page.svelte b/web/src/routes/(user)/search/+page.svelte index 3b7d6b8e6e..c9893166f9 100644 --- a/web/src/routes/(user)/search/+page.svelte +++ b/web/src/routes/(user)/search/+page.svelte @@ -173,7 +173,7 @@ make: 'Camera brand', model: 'Camera model', personIds: 'People', - originalPath: 'File name', + originalFileName: 'File name', }; return keyMap[key] || key; }