diff --git a/claims/claim-utils/service/contexts.service.ts b/claims/claim-utils/service/contexts.service.ts index bac39660..094b47d7 100644 --- a/claims/claim-utils/service/contexts.service.ts +++ b/claims/claim-utils/service/contexts.service.ts @@ -11,7 +11,7 @@ export class ContextsService { private promise: Promise; private sub: Subscription = null; - constructor(private http: HttpClient ) { + constructor(private http: HttpClient=null ) { } ngOnDestroy() { diff --git a/landingPages/landing-utils/parsingFunctions.class.ts b/landingPages/landing-utils/parsingFunctions.class.ts index fb3816a0..aa6a6601 100644 --- a/landingPages/landing-utils/parsingFunctions.class.ts +++ b/landingPages/landing-utils/parsingFunctions.class.ts @@ -484,8 +484,7 @@ export class ParsingFunctions { if (!identifiers.has(pid.classid)) { identifiers.set(pid.classid, new Array()); } - - identifiers.get(pid.classid).push(pid.content); + identifiers.get(pid.classid).push(pid.content+""); } } else { for (let i = 0; i < pid.length; i++) { @@ -493,7 +492,7 @@ export class ParsingFunctions { if (!identifiers.has(pid[i].classid)) { identifiers.set(pid[i].classid, new Array()); } - identifiers.get(pid[i].classid).push(pid[i].content); + identifiers.get(pid[i].classid).push(pid[i].content+""); } } } diff --git a/services/searchResearchResults.service.ts b/services/searchResearchResults.service.ts index 9872d559..dd93c74a 100644 --- a/services/searchResearchResults.service.ts +++ b/services/searchResearchResults.service.ts @@ -13,8 +13,8 @@ import {properties} from "../../../environments/environment"; export class SearchResearchResultsService { private sizeOfDescription: number = 270; public parsingFunctions: ParsingFunctions = new ParsingFunctions(); - - constructor(private http: HttpClient) { + + constructor(private http: HttpClient=null) { } @@ -174,9 +174,12 @@ export class SearchResearchResultsService { parseResults(resultType: string, data: any, properties: EnvProperties): SearchResult[] { let results: SearchResult[] = []; - + if(data == null) { + return results; + } + let length = Array.isArray(data) ? data.length : 1; - + for (let i = 0; i < length; i++) { let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:result'] : data['result']['metadata']['oaf:entity']['oaf:result']; @@ -207,8 +210,8 @@ export class SearchResearchResultsService { } else { for (let i = 0; i < resData['pid'].length; i++) { if (resData['pid'][i].classid == 'doi') { - if (resData['pid'][i].content != '' && resData['pid'][i].content != null) { - result.DOIs.push(resData['pid'][i].content.replace("https://doi.org/", "")); + if (resData['pid'][i].content != '' && resData['pid'][i].content != null && resData['pid'][i].content) { + result.DOIs.push((resData['pid'][i].content+"").replace("https://doi.org/", "")); } } }