1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2024-12-29 15:11:58 +00:00

fix(server): fix inconsistent explore queries (#5774)

* remove limits

* update sql
This commit is contained in:
Mert 2023-12-17 12:04:35 -05:00 committed by GitHub
parent 08f66c2ae5
commit e3fa32ad23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 14 deletions

View file

@ -706,9 +706,7 @@ export class AssetRepository implements IAssetRepository {
.createQueryBuilder('e') .createQueryBuilder('e')
.select('city') .select('city')
.groupBy('city') .groupBy('city')
.having('count(city) >= :minAssetsPerField', { minAssetsPerField }) .having('count(city) >= :minAssetsPerField', { minAssetsPerField });
.orderBy('random()')
.limit(maxFields);
const items = await this.getBuilder({ const items = await this.getBuilder({
userIds: [ownerId], userIds: [ownerId],
@ -737,9 +735,7 @@ export class AssetRepository implements IAssetRepository {
.createQueryBuilder('si') .createQueryBuilder('si')
.select('unnest(tags)', 'tag') .select('unnest(tags)', 'tag')
.groupBy('tag') .groupBy('tag')
.having('count(*) >= :minAssetsPerField', { minAssetsPerField }) .having('count(*) >= :minAssetsPerField', { minAssetsPerField });
.orderBy('random()')
.limit(maxFields);
const items = await this.getBuilder({ const items = await this.getBuilder({
userIds: [ownerId], userIds: [ownerId],

View file

@ -618,10 +618,6 @@ WITH
city city
HAVING HAVING
count(city) >= $1 count(city) >= $1
ORDER BY
random() ASC
LIMIT
12
) )
SELECT DISTINCT SELECT DISTINCT
ON (c.city) "asset"."id" AS "data", ON (c.city) "asset"."id" AS "data",
@ -653,10 +649,6 @@ WITH
tag tag
HAVING HAVING
count(*) >= $1 count(*) >= $1
ORDER BY
random() ASC
LIMIT
12
) )
SELECT DISTINCT SELECT DISTINCT
ON (unnest("si"."tags")) "asset"."id" AS "data", ON (unnest("si"."tags")) "asset"."id" AS "data",