diff --git a/server/src/utils/works.js b/server/src/utils/works.js index e64997f..a46961c 100644 --- a/server/src/utils/works.js +++ b/server/src/utils/works.js @@ -93,6 +93,9 @@ const getFosmQuery = (options, pit, searchAfter) => { }, }); } + if (options?.excludedRors?.length > 0) { + query.query.bool.must_not.push({ terms: { 'rors.keyword': options.excludedRors.split(' ') } }); + } return query; }; @@ -357,6 +360,9 @@ const getOpenAlexPublicationsByYear = (options, cursor = '*', previousResponse = if (options.openAlexExclusions.length) { url += `,${options.openAlexExclusions.map((institutionId) => `authorships.institutions.lineage:!${institutionId}`).join()}`; } + if (options?.excludedRors?.length) { + url += `,${options.excludedRors.split(' ').map((excludedRor) => `institutions.ror:!${excludedRor}`).join()}`; + } // Polite mode https://docs.openalex.org/how-to-use-the-api/rate-limits-and-authentication#the-polite-pool if (process?.env?.OPENALEX_KEY) { url += `&api_key=${process.env.OPENALEX_KEY}`;