1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-03-25 17:32:33 +01:00

feat(server): search by partial asset path ()

Similarly to how one can search by partial filename, change the
path search to work with partial matches instead of looking for a
full match.

Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
Krassimir Valev 2025-02-19 15:32:52 +01:00 committed by GitHub
parent b13a98646f
commit 8634c59850
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -394,7 +394,9 @@ export function searchAssetBuilder(kysely: Kysely<DB>, options: AssetSearchBuild
.$if(!!options.libraryId, (qb) => qb.where('assets.libraryId', '=', asUuid(options.libraryId!)))
.$if(!!options.userIds, (qb) => qb.where('assets.ownerId', '=', anyUuid(options.userIds!)))
.$if(!!options.encodedVideoPath, (qb) => qb.where('assets.encodedVideoPath', '=', options.encodedVideoPath!))
.$if(!!options.originalPath, (qb) => qb.where('assets.originalPath', '=', options.originalPath!))
.$if(!!options.originalPath, (qb) =>
qb.where(sql`f_unaccent(assets."originalPath")`, 'ilike', sql`'%' || f_unaccent(${options.originalPath}) || '%'`),
)
.$if(!!options.originalFileName, (qb) =>
qb.where(
sql`f_unaccent(assets."originalFileName")`,