mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
parent
7571788bc7
commit
ee355dd012
@ -137,7 +137,7 @@ export class SearchManager implements ISearchManager {
|
|||||||
.innerJoin(q => {
|
.innerJoin(q => {
|
||||||
const subQuery = q.from(usedEntity, 'media')
|
const subQuery = q.from(usedEntity, 'media')
|
||||||
.select('distinct media.id')
|
.select('distinct media.id')
|
||||||
.limit(2000);
|
.limit(Config.Client.Search.maxMediaResult + 1);
|
||||||
|
|
||||||
|
|
||||||
if (!searchType || searchType === SearchTypes.directory) {
|
if (!searchType || searchType === SearchTypes.directory) {
|
||||||
@ -180,7 +180,7 @@ export class SearchManager implements ISearchManager {
|
|||||||
|
|
||||||
result.media = await this.loadMediaWithFaces(query);
|
result.media = await this.loadMediaWithFaces(query);
|
||||||
|
|
||||||
if (result.media.length > 2000) {
|
if (result.media.length > Config.Client.Search.maxMediaResult) {
|
||||||
result.resultOverflow = true;
|
result.resultOverflow = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,10 +188,10 @@ export class SearchManager implements ISearchManager {
|
|||||||
.getRepository(DirectoryEntity)
|
.getRepository(DirectoryEntity)
|
||||||
.createQueryBuilder('dir')
|
.createQueryBuilder('dir')
|
||||||
.where('dir.name LIKE :text COLLATE utf8_general_ci', {text: '%' + text + '%'})
|
.where('dir.name LIKE :text COLLATE utf8_general_ci', {text: '%' + text + '%'})
|
||||||
.limit(201)
|
.limit(Config.Client.Search.maxMediaResult + 1)
|
||||||
.getMany();
|
.getMany();
|
||||||
|
|
||||||
if (result.directories.length > 200) {
|
if (result.directories.length > Config.Client.Search.maxDirectoryResult) {
|
||||||
result.resultOverflow = true;
|
result.resultOverflow = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,10 @@ export module ClientConfig {
|
|||||||
searchCacheTimeout: number = 1000 * 60 * 60;
|
searchCacheTimeout: number = 1000 * 60 * 60;
|
||||||
@ConfigProperty()
|
@ConfigProperty()
|
||||||
AutoComplete: AutoCompleteConfig = new AutoCompleteConfig();
|
AutoComplete: AutoCompleteConfig = new AutoCompleteConfig();
|
||||||
|
@ConfigProperty({type: 'unsignedInt'})
|
||||||
|
maxMediaResult: number = 2000;
|
||||||
|
@ConfigProperty({type: 'unsignedInt'})
|
||||||
|
maxDirectoryResult: number = 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubConfigClass()
|
@SubConfigClass()
|
||||||
|
Loading…
Reference in New Issue
Block a user