From 54a6740b6a3381a3a4bb1dfa40fac3e9f6269905 Mon Sep 17 00:00:00 2001 From: dbarkowsky Date: Tue, 9 Jul 2024 10:10:50 -0700 Subject: [PATCH] make fuzzy search case insensitive, fix pid search --- .../src/services/properties/propertiesServices.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/express-api/src/services/properties/propertiesServices.ts b/express-api/src/services/properties/propertiesServices.ts index 21b3aeaf7..b836109c7 100644 --- a/express-api/src/services/properties/propertiesServices.ts +++ b/express-api/src/services/properties/propertiesServices.ts @@ -50,11 +50,11 @@ const propertiesFuzzySearch = async (keyword: string, limit?: number, agencyIds? .leftJoinAndSelect('parcel.Classification', 'classification') .where( new Brackets((qb) => { - qb.where(`parcel.pid::text like '%${keyword}%'`) - .orWhere(`parcel.pin::text like '%${keyword}%'`) - .orWhere(`agency.name like '%${keyword}%'`) - .orWhere(`adminArea.name like '%${keyword}%'`) - .orWhere(`parcel.address1 like '%${keyword}%'`); + qb.where(`parcel.pid::text ILIKE '%${parseInt(keyword.replaceAll('-', ''))}%'`) + .orWhere(`parcel.pin::text ILIKE '%${keyword}%'`) + .orWhere(`agency.name ILIKE '%${keyword}%'`) + .orWhere(`adminArea.name ILIKE '%${keyword}%'`) + .orWhere(`parcel.address1 ILIKE '%${keyword}%'`); }), ) .andWhere(`classification.Name in ('Surplus Encumbered', 'Surplus Active')`);