From d02e3cbd3373c57ea65b0d5661aeb2df79ff9d1d Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Sun, 14 Mar 2021 18:23:30 +0100 Subject: [PATCH] Fixing persons metadata sql field charset --- src/backend/model/database/sql/enitites/MediaEntity.ts | 4 +++- src/common/entities/SearchQueryDTO.ts | 1 - test/backend/unit/model/sql/PersonManager.ts | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/backend/model/database/sql/enitites/MediaEntity.ts b/src/backend/model/database/sql/enitites/MediaEntity.ts index b9da3a51..2d51fedf 100644 --- a/src/backend/model/database/sql/enitites/MediaEntity.ts +++ b/src/backend/model/database/sql/enitites/MediaEntity.ts @@ -52,7 +52,9 @@ export class MediaMetadataEntity implements MediaMetadata { @OneToMany(type => FaceRegionEntry, faceRegion => faceRegion.media) faces: FaceRegionEntry[]; - @Column('simple-array', {select: false, nullable: true}) + @Column({type: 'simple-array', select: false, nullable: true, + charset: columnCharsetCS.charset, + collation: columnCharsetCS.collation}) persons: string[]; // Caches the list of persons. Only used for searching @Column('int', {unsigned: true}) diff --git a/src/common/entities/SearchQueryDTO.ts b/src/common/entities/SearchQueryDTO.ts index 14623f55..fc564824 100644 --- a/src/common/entities/SearchQueryDTO.ts +++ b/src/common/entities/SearchQueryDTO.ts @@ -121,7 +121,6 @@ export namespace SearchQueryDTO { }; export const parse = (str: string, implicitOR = true): SearchQueryDTO => { - console.log('parsing: ' + str); str = str.replace(/\s\s+/g, ' ') // remove double spaces .replace(/:\s+/g, ':').replace(/\)(?=\S)/g, ') ').trim(); diff --git a/test/backend/unit/model/sql/PersonManager.ts b/test/backend/unit/model/sql/PersonManager.ts index 12a4dea4..1cc88db5 100644 --- a/test/backend/unit/model/sql/PersonManager.ts +++ b/test/backend/unit/model/sql/PersonManager.ts @@ -15,6 +15,7 @@ import {MediaDTO} from '../../../../../src/common/entities/MediaDTO'; // to help WebStorm to handle the test cases declare let describe: any; declare const after: any; +declare const before: any; declare const it: any; @@ -54,7 +55,7 @@ describe('PersonManager', (sqlHelper: SQLTestHelper) => { }; - beforeEach(async () => { + before(async () => { await setUpSqlDB(); });