mirror of
https://github.com/immich-app/immich.git
synced 2024-12-28 06:31:58 +00:00
fix(server): increase person search limit (#12619)
This commit is contained in:
parent
a373d50c31
commit
c717fd2131
3 changed files with 3 additions and 11 deletions
|
@ -215,19 +215,14 @@ SELECT
|
|||
"person"."isHidden" AS "person_isHidden"
|
||||
FROM
|
||||
"person" "person"
|
||||
LEFT JOIN "asset_faces" "face" ON "face"."personId" = "person"."id"
|
||||
WHERE
|
||||
"person"."ownerId" = $1
|
||||
AND (
|
||||
LOWER("person"."name") LIKE $2
|
||||
OR LOWER("person"."name") LIKE $3
|
||||
)
|
||||
GROUP BY
|
||||
"person"."id"
|
||||
ORDER BY
|
||||
COUNT("face"."assetId") DESC
|
||||
LIMIT
|
||||
20
|
||||
1000
|
||||
|
||||
-- PersonRepository.getDistinctNames
|
||||
SELECT DISTINCT
|
||||
|
|
|
@ -184,14 +184,11 @@ export class PersonRepository implements IPersonRepository {
|
|||
getByName(userId: string, personName: string, { withHidden }: PersonNameSearchOptions): Promise<PersonEntity[]> {
|
||||
const queryBuilder = this.personRepository
|
||||
.createQueryBuilder('person')
|
||||
.leftJoin('person.faces', 'face')
|
||||
.where(
|
||||
'person.ownerId = :userId AND (LOWER(person.name) LIKE :nameStart OR LOWER(person.name) LIKE :nameAnywhere)',
|
||||
{ userId, nameStart: `${personName.toLowerCase()}%`, nameAnywhere: `% ${personName.toLowerCase()}%` },
|
||||
)
|
||||
.groupBy('person.id')
|
||||
.orderBy('COUNT(face.assetId)', 'DESC')
|
||||
.limit(20);
|
||||
.limit(1000);
|
||||
|
||||
if (!withHidden) {
|
||||
queryBuilder.andWhere('person.isHidden = false');
|
||||
|
|
|
@ -93,7 +93,7 @@ export enum ActionQueryParameterValue {
|
|||
MERGE = 'merge',
|
||||
}
|
||||
|
||||
export const maximumLengthSearchPeople: number = 20;
|
||||
export const maximumLengthSearchPeople = 1000;
|
||||
|
||||
// time to load the map before displaying the loading spinner
|
||||
export const timeToLoadTheMap: number = 100;
|
||||
|
|
Loading…
Reference in a new issue