From 2be513fbc4ae74510850fe51468ed640110530a7 Mon Sep 17 00:00:00 2001 From: Nordine Bittich <3816305+nbittich@users.noreply.github.com> Date: Wed, 23 Mar 2022 09:04:43 +0100 Subject: [PATCH] change the filter search for name field (#287) --- app/routes/administrative-units/index.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app/routes/administrative-units/index.js b/app/routes/administrative-units/index.js index c8f6f0949..6feb074c0 100644 --- a/app/routes/administrative-units/index.js +++ b/app/routes/administrative-units/index.js @@ -41,14 +41,9 @@ export default class AdministrativeUnitsIndexRoute extends Route { const filter = {}; if (params.name) { - let filterType = 'phrase'; - let name = params.name - .trim() - .toLowerCase() - .replace(/[^a-z0-9]/gi, ' '); - if (name.split(' ').length === 1) { - filterType = 'prefix'; - } + let filterType = 'phrase_prefix'; + let name = params.name.trim(); + filter[`:${filterType}:name`] = name; }