fix(server): increase person search limit (#12619)

This commit is contained in:
Jason Rasmussen 2024-09-13 12:33:16 -04:00 committed by GitHub
parent a373d50c31
commit c717fd2131
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 11 deletions

View File

@ -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

View File

@ -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');

View File

@ -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;