diff --git a/src/backend/model/database/sql/SearchManager.ts b/src/backend/model/database/sql/SearchManager.ts index 408dfa10..4bc182f3 100644 --- a/src/backend/model/database/sql/SearchManager.ts +++ b/src/backend/model/database/sql/SearchManager.ts @@ -137,7 +137,7 @@ export class SearchManager implements ISearchManager { .innerJoin(q => { const subQuery = q.from(usedEntity, 'media') .select('distinct media.id') - .limit(2000); + .limit(Config.Client.Search.maxMediaResult + 1); if (!searchType || searchType === SearchTypes.directory) { @@ -180,7 +180,7 @@ export class SearchManager implements ISearchManager { result.media = await this.loadMediaWithFaces(query); - if (result.media.length > 2000) { + if (result.media.length > Config.Client.Search.maxMediaResult) { result.resultOverflow = true; } @@ -188,10 +188,10 @@ export class SearchManager implements ISearchManager { .getRepository(DirectoryEntity) .createQueryBuilder('dir') .where('dir.name LIKE :text COLLATE utf8_general_ci', {text: '%' + text + '%'}) - .limit(201) + .limit(Config.Client.Search.maxMediaResult + 1) .getMany(); - if (result.directories.length > 200) { + if (result.directories.length > Config.Client.Search.maxDirectoryResult) { result.resultOverflow = true; } diff --git a/src/common/config/public/ClientConfig.ts b/src/common/config/public/ClientConfig.ts index 8c320904..774310e4 100644 --- a/src/common/config/public/ClientConfig.ts +++ b/src/common/config/public/ClientConfig.ts @@ -35,6 +35,10 @@ export module ClientConfig { searchCacheTimeout: number = 1000 * 60 * 60; @ConfigProperty() AutoComplete: AutoCompleteConfig = new AutoCompleteConfig(); + @ConfigProperty({type: 'unsignedInt'}) + maxMediaResult: number = 2000; + @ConfigProperty({type: 'unsignedInt'}) + maxDirectoryResult: number = 200; } @SubConfigClass()