From c1213b9836b155600361798a4b65e3b927c44c4a Mon Sep 17 00:00:00 2001 From: argirok Date: Fri, 10 Jun 2022 11:19:40 +0300 Subject: [PATCH] SEO - jsonld: parse all subjects put keep at most 10 --- .../service/open-aire-jsonld-converter.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sharedComponents/schema2jsonld/service/open-aire-jsonld-converter.service.ts b/sharedComponents/schema2jsonld/service/open-aire-jsonld-converter.service.ts index e53c5183..a91beae7 100644 --- a/sharedComponents/schema2jsonld/service/open-aire-jsonld-converter.service.ts +++ b/sharedComponents/schema2jsonld/service/open-aire-jsonld-converter.service.ts @@ -314,7 +314,7 @@ convertDatasource(datasource: any, URL, otherUrl): Organization { return array; } - private getKeyword(result: any): String[] { + private getKeyword(result: any, classification:'FOS'|'SDG' |null = null): String[] { const subjects = _.get(result, "result.metadata.oaf:entity.oaf:result.subject", null); if (!subjects) return null; if (!Array.isArray(subjects)) return null; @@ -324,7 +324,7 @@ convertDatasource(datasource: any, URL, otherUrl): Organization { const subjectArray = subjects as Array; for (var i = 0; i < subjectArray.length; i += 1) { const classid = _.get(subjectArray[i], "classid", null); - if (classid !== "keyword") continue; + if(classification && classid !==classification) continue; const sub = _.get(subjectArray[i], "content", null); if (!sub) return null; @@ -332,7 +332,7 @@ convertDatasource(datasource: any, URL, otherUrl): Organization { array.push(sub as String); } if (array.length == 0) return null; - return array; + return array.slice(0,10); } private getCreator(result: any): Person[] {