Skip to content

Commit 95a6aee

Browse files
committed
fix(fundings): Improve / Correct ES query
1 parent 3a5fea4 commit 95a6aee

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

  • client/src/boards/financements-par-aap

client/src/boards/financements-par-aap/utils.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ const funders = ["ANR", "PIA ANR", "PIA hors ANR", "Horizon 2020", "Horizon Euro
44

55
const pattern = { height: 4, path: "M 2 2 l 2 2", width: 4 };
66

7-
const typologiesExcluded = ["Entreprises", "Infrastructures de recherche", "Structures de recherche"];
8-
97
const YEAR_MIN = 2009;
108
const YEAR_MAX = 2025
119
const years: number[] = Array.from(Array(YEAR_MAX - YEAR_MIN + 1).keys()).map((item) => item + YEAR_MIN);
@@ -47,7 +45,6 @@ const getEsQuery = ({ regions, structures, yearMax = years[years.length - 1], ye
4745
{ term: { participant_isFrench: true } },
4846
{ term: { participant_status: "active" } },
4947
{ terms: { "project_type.keyword": funders } },
50-
{ bool: { must_not: { terms: { "participant_typologie_1.keyword": typologiesExcluded } } } },
5148
],
5249
},
5350
},
@@ -56,11 +53,12 @@ const getEsQuery = ({ regions, structures, yearMax = years[years.length - 1], ye
5653
if (structuresNotNull?.length ?? 0 > 0) {
5754
query.query.bool.filter.push({ term: { participant_is_main_parent: 1 } });
5855
query.query.bool.filter.push({ term: { participant_type: "institution" } });
56+
query.query.bool.filter.push({ terms: { "participant_typologie_1.keyword": ["Ecoles, instituts et assimilés", "Organismes de recherche", "Universités et assimilés"] } });
5957
query.query.bool.filter.push({ terms: { "participant_id.keyword": structuresNotNull } });
60-
query.query.bool.filter.push({ term: { "participant_kind.keyword": "Secteur public" } });
6158
};
6259
const regionsNotNull = regions?.filter((region) => region !== null);
6360
if (regionsNotNull?.length ?? 0 > 0) {
61+
query.query.bool.filter.push({ terms: { "participant_typologie_1.keyword": ["Ecoles, instituts et assimilés", "Organismes de recherche", "Structures de recherche", "Universités et assimilés"] } });
6462
query.query.bool.filter.push({ terms: { "participant_region_with_labs.keyword": regionsNotNull } });
6563
};
6664
return query;

0 commit comments

Comments
 (0)