diff --git a/server/src/queries/person.repository.sql b/server/src/queries/person.repository.sql index ad94fb774e..c77d9835fa 100644 --- a/server/src/queries/person.repository.sql +++ b/server/src/queries/person.repository.sql @@ -222,6 +222,21 @@ where "person"."ownerId" = $3 and "asset_faces"."deletedAt" is null +-- PersonRepository.refreshFaces +with + "added_embeddings" as ( + insert into + "face_search" ("faceId", "embedding") + values + ($1, $2) + ) +select +from + ( + select + 1 + ) as "dummy" + -- PersonRepository.getFacesByIds select "asset_faces".*, diff --git a/server/src/repositories/database.repository.ts b/server/src/repositories/database.repository.ts index 8a2b105ac6..afb5241e96 100644 --- a/server/src/repositories/database.repository.ts +++ b/server/src/repositories/database.repository.ts @@ -115,10 +115,10 @@ export class DatabaseRepository { async createExtension(extension: DatabaseExtension): Promise { await sql`CREATE EXTENSION IF NOT EXISTS ${sql.raw(extension)} CASCADE`.execute(this.db); if (extension === DatabaseExtension.VECTORCHORD) { - const db = await this.getDatabaseName(); - await sql`ALTER DATABASE ${sql.table(db)} SET vchordrq.prewarm_dim = '512,640,768,1024,1152,1536'`.execute(this.db); + const dbName = sql.table(await this.getDatabaseName()); + await sql`ALTER DATABASE ${dbName} SET vchordrq.prewarm_dim = '512,640,768,1024,1152,1536'`.execute(this.db); await sql`SET vchordrq.prewarm_dim = '512,640,768,1024,1152,1536'`.execute(this.db); - await sql`ALTER DATABASE ${sql.table(db)} SET vchordrq.probes = 1`.execute(this.db); + await sql`ALTER DATABASE ${dbName} SET vchordrq.probes = 1`.execute(this.db); await sql`SET vchordrq.probes = 1`.execute(this.db); } } diff --git a/server/src/repositories/person.repository.ts b/server/src/repositories/person.repository.ts index 9433254135..789c47ccaf 100644 --- a/server/src/repositories/person.repository.ts +++ b/server/src/repositories/person.repository.ts @@ -400,6 +400,7 @@ export class PersonRepository { return results.map(({ id }) => id); } + @GenerateSql({ params: [[], [], [{ faceId: DummyValue.UUID, embedding: DummyValue.VECTOR }]] }) async refreshFaces( facesToAdd: (Insertable & { assetId: string })[], faceIdsToRemove: string[],