mirror of
https://github.com/immich-app/immich
synced 2026-08-22 13:13:05 +00:00
fix(server): search statistics with personIds returns 500 (#25074)
The searchAssetBuilder was incorrectly adding withFacesAndPeople select when personIds was provided. This caused a SQL error because the subquery referenced asset.id which wasn't selected in statistics queries (only count(*) was selected). The fix removes personIds from the condition that triggers adding faces data to the select. The hasPeople filter (for personIds) is still applied correctly for filtering. Fixes #25003 Signed-off-by: majiayu000 <1835304752@qq.com>
This commit is contained in:
parent
f22affd836
commit
263f96da87
2 changed files with 38 additions and 2 deletions
|
|
@ -446,7 +446,7 @@ export function searchAssetBuilder(kysely: Kysely<DB>, options: AssetSearchBuild
|
|||
qb.where((eb) => eb.not(eb.exists((eb) => eb.selectFrom('album_asset').whereRef('assetId', '=', 'asset.id')))),
|
||||
)
|
||||
.$if(!!options.withExif, withExifInner)
|
||||
.$if(!!(options.withFaces || options.withPeople || options.personIds), (qb) => qb.select(withFacesAndPeople))
|
||||
.$if(!!(options.withFaces || options.withPeople), (qb) => qb.select(withFacesAndPeople))
|
||||
.$if(!options.withDeleted, (qb) => qb.where('asset.deletedAt', 'is', null));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue