[ develop | DONE | CHANGED] Utils services: update funders response, remove open access filter from results query in /explore/search
This commit is contained in:
parent
46ad6aef36
commit
7761eeeedc
|
@ -150,7 +150,7 @@ app.get('/explore/search', async function (req, res) {
|
|||
try {
|
||||
// Make requests to multiple APIs
|
||||
let requests= [
|
||||
searchServiceAPIUrl +'resources2/?format=json&size=0&type=results&fq=resultbestaccessright%20exact%20%22Open%20Access%22',
|
||||
searchServiceAPIUrl +'resources2/?format=json&size=0&type=results',
|
||||
searchServiceAPIUrl + 'datasources/count?format=json',
|
||||
searchServiceAPIUrl + 'resources2/?format=json&size=0&type=organizations&fq=(reldatasourcecompatibilityid exact driver or reldatasourcecompatibilityid exact driver-openaire2.0 or reldatasourcecompatibilityid exact openaire2.0 or reldatasourcecompatibilityid exact openaire3.0 or reldatasourcecompatibilityid exact openaire4.0 or reldatasourcecompatibilityid exact openaire-cris_1.1 or reldatasourcecompatibilityid exact openaire2.0_data or reldatasourcecompatibilityid exact hostedBy or relproject=*)',
|
||||
searchServiceAPIUrl + 'projects/count?format=json'
|
||||
|
@ -198,13 +198,13 @@ app.get('/explore/funders', async function (req, res) {
|
|||
let resultsFunders = dataResponses[0].data.refineResults.relfunder;
|
||||
resultsFunders.forEach(queriedFunder => {
|
||||
if (!fundersMap.has(queriedFunder.id)) {
|
||||
fundersMap.set(queriedFunder.id,{name: queriedFunder.name, id: queriedFunder.id, results:queriedFunder.count, openResults: null, projects:null, stakeholder:null});
|
||||
fundersMap.set(queriedFunder.id,{name: queriedFunder.name.split("||")[0], id: queriedFunder.id, results:queriedFunder.count, openResults: null, projects:null, stakeholder:null});
|
||||
}
|
||||
});
|
||||
let openResultsFunders = dataResponses[1].data.refineResults.relfunder;
|
||||
openResultsFunders.forEach(queriedFunder => {
|
||||
if (!fundersMap.has(queriedFunder.id)) {
|
||||
fundersMap.set(queriedFunder.id,{name: queriedFunder.name, id: queriedFunder.id, results:null, openResults: queriedFunder.count, projects:null, stakeholder:null});
|
||||
fundersMap.set(queriedFunder.id,{name: queriedFunder.name.split("||")[0], id: queriedFunder.id, results:null, openResults: queriedFunder.count, projects:null, stakeholder:null});
|
||||
}else{
|
||||
fundersMap.get(queriedFunder.id).openResults = queriedFunder.count;
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ app.get('/explore/funders', async function (req, res) {
|
|||
let projectFunders = dataResponses[2].data.refineResults.funder;
|
||||
projectFunders.forEach(queriedFunder => {
|
||||
if (!fundersMap.has(queriedFunder.id) ) {
|
||||
fundersMap.set(queriedFunder.id,{name: queriedFunder.name, id: queriedFunder.id, results:null, openResults: null, projects:queriedFunder.count, stakeholder:null});
|
||||
fundersMap.set(queriedFunder.id,{name: queriedFunder.name.split("||")[0], id: queriedFunder.id, results:null, openResults: null, projects:queriedFunder.count, stakeholder:null});
|
||||
}else{
|
||||
fundersMap.get(queriedFunder.id).projects = queriedFunder.count;
|
||||
}
|
||||
|
@ -221,10 +221,10 @@ app.get('/explore/funders', async function (req, res) {
|
|||
stakeholders.forEach(stakeholder => {
|
||||
let id = stakeholder.index_id + "||" + stakeholder.index_name + "||" + stakeholder.index_shortName;
|
||||
// console.log(id);
|
||||
if (!fundersMap.has(id)) {
|
||||
fundersMap.set(id,{name: stakeholder.index_name, id: id, results:null, openResults: null, projects:null, stakeholder:stakeholder});
|
||||
}else{
|
||||
fundersMap.get(id).stakeholder = stakeholder;
|
||||
if (fundersMap.has(id)) {
|
||||
let ministakeholder = {id:id, name:stakeholder.name, alias: stakeholder.alias, visibility: stakeholder.visibility,
|
||||
logoUrl:stakeholder.logoUrl, isUpload: stakeholder.isUpload}
|
||||
fundersMap.get(id).stakeholder = ministakeholder;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue