1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-23 02:06:15 +02:00

fix(server): face search results not always sorted (#7839)

* order by

* update sql
This commit is contained in:
Mert 2024-03-11 10:19:20 -04:00 committed by GitHub
parent 4027cba4eb
commit 8dc62bd29a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 0 deletions

View File

@ -188,6 +188,7 @@ export class SearchRepository implements ISearchRepository {
.addCommonTableExpression(cte, 'cte') .addCommonTableExpression(cte, 'cte')
.from('cte', 'res') .from('cte', 'res')
.where('res.distance <= :maxDistance', { maxDistance }) .where('res.distance <= :maxDistance', { maxDistance })
.orderBy('res.distance')
.getRawMany(); .getRawMany();
}); });
return results.map((row) => ({ return results.map((row) => ({

View File

@ -229,6 +229,8 @@ FROM
"cte" "res" "cte" "res"
WHERE WHERE
res.distance <= $3 res.distance <= $3
ORDER BY
res.distance ASC
COMMIT COMMIT
-- SearchRepository.searchPlaces -- SearchRepository.searchPlaces