Skip to content

Commit

Permalink
change the filter search for name field (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbittich committed Mar 23, 2022
1 parent 0750c54 commit 2be513f
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions app/routes/administrative-units/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 2be513f

Please sign in to comment.