High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
fix(server): add more conditions to smart search (#5806)
Mertb520955d0ea3
diff --git a/server/src/infra/repositories/smart-info.repository.ts b/server/src/infra/repositories/smart-info.repository.tsindex 57aaa4d3c7..340ffa9990 100644--- a/server/src/infra/repositories/smart-info.repository.ts+++ b/server/src/infra/repositories/smart-info.repository.ts@@ -56,6 +56,9 @@ export class SmartInfoRepository implements ISmartInfoRepository {.createQueryBuilder(AssetEntity, 'a').innerJoin('a.smartSearch', 's').where('a.ownerId = :ownerId')+ .andWhere('a.isVisible = true')+ .andWhere('a.isArchived = false')+ .andWhere('a.fileCreatedAt < NOW()').leftJoinAndSelect('a.exifInfo', 'e').orderBy('s.embedding <=> :embedding').setParameters({ ownerId, embedding: asVector(embedding) })diff --git a/server/src/infra/sql/smart.info.repository.sql b/server/src/infra/sql/smart.info.repository.sqlindex 50cbfa71fc..c03168d879 100644--- a/server/src/infra/sql/smart.info.repository.sql+++ b/server/src/infra/sql/smart.info.repository.sql@@ -66,7 +66,12 @@ FROMINNER JOIN "smart_search" "s" ON "s"."assetId" = "a"."id"LEFT JOIN "exif" "e" ON "e"."assetId" = "a"."id"WHERE- ("a"."ownerId" = $1)+ (+ "a"."ownerId" = $1+ AND "a"."isVisible" = true+ AND "a"."isArchived" = false+ AND "a"."fileCreatedAt" < NOW()+ )AND ("a"."deletedAt" IS NULL)ORDER BY"s"."embedding" <= > $2 ASC