diff --git a/client/src/pages/home/filters.jsx b/client/src/pages/home/filters.jsx index 3455e9d0..02f92187 100644 --- a/client/src/pages/home/filters.jsx +++ b/client/src/pages/home/filters.jsx @@ -27,7 +27,6 @@ export default function Filters({ sendQuery }) { if (searchParams.size === 0) { setSearchParams({ affiliations: [], - affiliationsToExclude: [], affiliationsToInclude: [], dataIdentifiers: identifiers, datasources: sources.map((source) => source.key), @@ -38,7 +37,6 @@ export default function Filters({ sendQuery }) { } else { setCurrentSearchParams({ affiliations: searchParams.getAll('affiliations'), - affiliationsToExclude: searchParams.getAll('affiliationsToExclude'), affiliationsToInclude: searchParams.getAll('affiliationsToInclude'), dataIdentifiers: searchParams.getAll('dataIdentifiers'), datasources: searchParams.getAll('datasources'), @@ -113,28 +111,16 @@ export default function Filters({ sendQuery }) { { currentSearchParams.moreOptions && ( - <> - - - setSearchParams({ ...currentSearchParams, affiliationsToInclude })} - tags={currentSearchParams.affiliationsToInclude} - /> - - - - - setSearchParams({ ...currentSearchParams, affiliationsToExclude })} - tags={currentSearchParams.affiliationsToExclude} - /> - - - + + + setSearchParams({ ...currentSearchParams, affiliationsToInclude })} + tags={currentSearchParams.affiliationsToInclude} + /> + + ) } diff --git a/client/src/pages/home/index.jsx b/client/src/pages/home/index.jsx index 7e0d94c3..a0011980 100644 --- a/client/src/pages/home/index.jsx +++ b/client/src/pages/home/index.jsx @@ -55,21 +55,18 @@ const getRorAffiliations = (affiliations) => { const getData = async (options) => { const promises = [getBsoPublications({ options, index: VITE_BSO_PUBLICATIONS_INDEX })]; const { notRorAffiliations, rorAffiliations } = getRorAffiliations(options.affiliations); - const { notRorAffiliations: notRorAffiliationsToExclude, rorAffiliations: rorAffiliationsToExclude } = getRorAffiliations(options.affiliationsToExclude); const { notRorAffiliations: notRorAffiliationsToInclude, rorAffiliations: rorAffiliationsToInclude } = getRorAffiliations(options.affiliationsToInclude); - if (notRorAffiliations.length || notRorAffiliationsToExclude.length || notRorAffiliationsToInclude.length) { + if (notRorAffiliations.length || notRorAffiliationsToInclude.length) { promises.push(getOpenAlexPublications({ ...options, affiliations: notRorAffiliations, - affiliationsToExclude: notRorAffiliationsToExclude, affiliationsToInclude: notRorAffiliationsToInclude, }, false)); } - if (rorAffiliations.length || rorAffiliationsToExclude.length || rorAffiliationsToInclude.length) { + if (rorAffiliations.length || rorAffiliationsToInclude.length) { promises.push(getOpenAlexPublications({ ...options, affiliations: rorAffiliations, - affiliationsToExclude: rorAffiliationsToExclude, affiliationsToInclude: rorAffiliationsToInclude, }, true)); } diff --git a/client/src/utils/works.js b/client/src/utils/works.js index e16e648d..fee44aca 100644 --- a/client/src/utils/works.js +++ b/client/src/utils/works.js @@ -18,9 +18,6 @@ const getBsoQuery = (options, pit, searchAfter) => { options.affiliations.forEach((affiliation) => { query.query.bool.should.push({ multi_match: { fields: affiliationsFields, query: `"${affiliation}"`, operator: 'and' } }); }); - options.affiliationsToExclude.forEach((affiliationToExclude) => { - query.query.bool.must_not.push({ multi_match: { fields: affiliationsFields, query: affiliationToExclude, operator: 'and' } }); - }); options.affiliationsToInclude.forEach((affiliationToInclude) => { query.query.bool.must.push({ multi_match: { fields: affiliationsFields, query: `"${affiliationToInclude}"`, operator: 'and' } }); }); @@ -212,16 +209,14 @@ const getOpenAlexPublications = (options, isRor = false, page = '1', previousRes } else if (options?.endYear) { url += `,publication_year:-${Number(options.endYear)}`; } - if (options.affiliations.length || options.affiliationsToExclude.length || options.affiliationsToInclude.length) { + if (options.affiliations.length || options.affiliationsToInclude.length) { if (isRor) { url += ''; if (options.affiliations.length) url += `,institutions.ror:${options.affiliations.join('|')}`; - if (options.affiliationsToExclude.length) url += options.affiliationsToExclude.map((affiliation) => `,institutions.ror:!${affiliation}`).join(''); if (options.affiliationsToInclude.length) url += options.affiliationsToInclude.map((affiliation) => `,institutions.ror:${affiliation}`).join(''); } else { url += ',raw_affiliation_string.search:'; if (options.affiliations.length) url += `(${options.affiliations.map((aff) => `"${aff}"`).join(' OR ')})`; - if (options.affiliationsToExclude.length) url += `${options.affiliationsToExclude.map((aff) => ` AND NOT ${aff}`).join('')}`; if (options.affiliationsToInclude.length) url += `${options.affiliationsToInclude.map((aff) => ` AND "${aff}"`).join('')}`; } }