diff --git a/client/src/pages/home/index.jsx b/client/src/pages/home/index.jsx index 8eebd370..754c823a 100644 --- a/client/src/pages/home/index.jsx +++ b/client/src/pages/home/index.jsx @@ -156,6 +156,7 @@ export default function Home() { let allPublicationsTmp = []; if (data) { allDatasetsTmp = data.datasets + .filter((dataset) => !!dataset?.affiliations) .map((dataset) => ({ ...dataset, affiliationsHtml: getAffiliationsHtmlField(dataset, regexp), diff --git a/server/src/routes/works.routes.js b/server/src/routes/works.routes.js index 5b0da02a..12a5f1fd 100644 --- a/server/src/routes/works.routes.js +++ b/server/src/routes/works.routes.js @@ -19,7 +19,7 @@ router.route('/works') const results = await Promise.all([ getBsoWorks({ options, index: process.env.VITE_BSO_PUBLICATIONS_INDEX }), getOpenAlexPublications(options), - getBsoWorks({ options, index: process.env.VITE_BSO_DATASETS_INDEX }), + getBsoWorks({ options, index: process.env.VITE_BSO_DATASETS_INDEX, filter: 'q=genre:dataset' }), ]); const data = { datasets: [], publications: [], total: {} }; results.slice(0, 2).forEach((publication) => { diff --git a/server/src/utils.js b/server/src/utils.js index 1735f5e8..4535dfb7 100644 --- a/server/src/utils.js +++ b/server/src/utils.js @@ -48,7 +48,9 @@ const getBsoCount = async (options) => { return 'Oops... BSO API request did not work'; }; -const getBsoWorks = async ({ allResults = [], index = process.env.VITE_BSO_PUBLICATIONS_INDEX, options, pit, searchAfter }) => { +const getBsoWorks = async ({ + allResults = [], filter, index = process.env.VITE_BSO_PUBLICATIONS_INDEX, options, pit, searchAfter, +}) => { if (!pit) { const response = await fetch( `${process.env.VITE_BSO_URL}/${index}/_pit?keep_alive=${process.env.VITE_BSO_PIT_KEEP_ALIVE}`, @@ -69,7 +71,11 @@ const getBsoWorks = async ({ allResults = [], index = process.env.VITE_BSO_PUBLI Authorization: process.env.VITE_BSO_AUTH, }, }; - return fetch(`${process.env.VITE_BSO_URL}/_search`, params) + let url = `${process.env.VITE_BSO_URL}/_search`; + if (filter) { + url += `?${filter}`; + } + return fetch(url, params) .then((response) => { if (response.ok) return response.json(); return 'Oops... BSO API request did not work'; @@ -90,7 +96,7 @@ const getBsoWorks = async ({ allResults = [], index = process.env.VITE_BSO_PUBLI if (hits.length > 0 && (Number(process.env.VITE_BSO_MAX_SIZE) === 0 || allResults.length < Number(process.env.VITE_BSO_MAX_SIZE))) { // eslint-disable-next-line no-param-reassign searchAfter = hits.at('-1').sort; - return getBsoWorks({ allResults, index, options, pit, searchAfter }); + return getBsoWorks({ allResults, filter, index, options, pit, searchAfter }); } if (pit) { fetch(