diff --git a/src/client/src/containers/Search/Search.js b/src/client/src/containers/Search/Search.js index 59730993..a13dff64 100644 --- a/src/client/src/containers/Search/Search.js +++ b/src/client/src/containers/Search/Search.js @@ -13,7 +13,6 @@ import { useSearchTerms, } from "../../services/Store/hooks/search"; import { normalizeCodeCommunes } from "../../utils/code-commune/code-commune"; -import { normalizeCodeDepartement } from "../../utils/code-departement/code-departement"; import { useFileDownload } from "../../utils/file-download/hooks"; import { useSort } from "../../utils/search-table/hooks"; import divisionsNaf from "./divisions-naf.json"; @@ -31,9 +30,7 @@ const formatLocationFilter = (filters) => { codesCommunes: normalizeCodeCommunes( locationFilters?.commune?.map(prop("value")) || [] ), - departements: normalizeCodeDepartement( - locationFilters?.departement?.map(prop("value")) || [] - ), + departements: locationFilters?.departement?.map(prop("value")) || [], }; }; diff --git a/src/client/src/utils/code-departement/code-departement.js b/src/client/src/utils/code-departement/code-departement.js deleted file mode 100644 index 895d1a6e..00000000 --- a/src/client/src/utils/code-departement/code-departement.js +++ /dev/null @@ -1,16 +0,0 @@ -const CORSE_DEP = ["2A", "2B"]; -const CORSE_DEP_CODES = { - "2A": ["2A", "20"], - "2B": ["2B", "21"], -}; - -const getCodeDepartementForCorse = (codeDep) => { - if (CORSE_DEP.includes(codeDep)) { - return CORSE_DEP_CODES[codeDep]; - } - - return [codeDep]; -}; -export const normalizeCodeDepartement = (codedepartement) => { - return codedepartement.flatMap(getCodeDepartementForCorse); -}; diff --git a/src/server/src/utils/elastic.js b/src/server/src/utils/elastic.js index e84b4f67..5177d82c 100644 --- a/src/server/src/utils/elastic.js +++ b/src/server/src/utils/elastic.js @@ -14,7 +14,7 @@ const filtersFieldMap = { etats: "etatAdministratifEtablissement", activites: "domaineActivite", codesCommunes: "codeCommuneEtablissement", - departements: "departementEtablissement", + departement: "departement", codesPostaux: "codesPostalEtablissement", tranchesEffectifs: "trancheEffectifsEtablissement", }; @@ -214,7 +214,7 @@ export const getElasticQueryParams = (req) => { const activites = req.query["activites"] || []; const codesCommunes = req.query["codesCommunes"] || []; const codesPostaux = req.query["codesPostaux"] || []; - const departements = req.query["departements"] || []; + const departement = req.query["departements"] || []; const tranchesEffectifs = req.query["tranchesEffectifs"] || []; const dirigeant = req.query["dirigeant"] ? JSON.parse(req.query["dirigeant"]) @@ -233,7 +233,7 @@ export const getElasticQueryParams = (req) => { etats, activites, codesCommunes, - departements, + departement, codesPostaux, tranchesEffectifs, dirigeant,