From 6c0724f02641c8dee1862cce27018f0dea56b0a4 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Thu, 17 Mar 2022 15:13:07 +0200 Subject: [PATCH 1/3] Rename some result refine filter names and reorder them. --- .../result/resultLanding.component.html | 4 ++-- .../searchUtils/newSearchPage.component.ts | 2 +- utils/properties/searchFields.ts | 19 +++++++++---------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/landingPages/result/resultLanding.component.html b/landingPages/result/resultLanding.component.html index a58172d0..2d9612b6 100644 --- a/landingPages/result/resultLanding.component.html +++ b/landingPages/result/resultLanding.component.html @@ -184,7 +184,7 @@
- Fields of Science and Technology classification + Fields of Science and Technology classification (FOS)
@@ -194,7 +194,7 @@
- Sustainable Development Goals + Sustainable Development Goals (SDG)
diff --git a/searchPages/searchUtils/newSearchPage.component.ts b/searchPages/searchUtils/newSearchPage.component.ts index 0eeef309..8c326c73 100644 --- a/searchPages/searchUtils/newSearchPage.component.ts +++ b/searchPages/searchUtils/newSearchPage.component.ts @@ -1429,7 +1429,7 @@ public static createRangeFilterQuery(rangeField,selectedFromValue, selectedToVal } }*/ if ((this.entityType == 'publication' || this.entityType == 'dataset' || this.entityType == 'software' || this.entityType == 'other' || this.entityType == "result")) { - this.resultTypes = {values:[],filterId:"type", countSelectedValues: 0, filterType: 'checkbox', originalFilterId: "", valueIsExact: true, title: "Result Types",filterOperator:"or"}; + this.resultTypes = {values:[],filterId:"type", countSelectedValues: 0, filterType: 'checkbox', originalFilterId: "", valueIsExact: true, title: "Type",filterOperator:"or"}; if (URLparams["type"]) { let types = URLparams["type"]; types = Array.isArray(types) ? types.join(',').split(","):types.split(","); diff --git a/utils/properties/searchFields.ts b/utils/properties/searchFields.ts index 6a8105a6..7953aeb8 100644 --- a/utils/properties/searchFields.ts +++ b/utils/properties/searchFields.ts @@ -11,10 +11,9 @@ export class SearchFields { // Remove Collected From Filter "collectedfrom","collectedfrom" public RESULT_REFINE_FIELDS = [ - "resultbestaccessright", "relfunder", + "resultbestaccessright", "instancetypename", "fos", "relfunder", "relfundinglevel0_id", "relfundinglevel1_id", "relfundinglevel2_id", - "relproject", - "instancetypename", "resultlanguagename", "community", "resulthostingdatasource", "country", "sdg", "fos"]; + "relproject", "sdg", "country", "resultlanguagename", "resulthostingdatasource", "community"]; public RESULT_ADVANCED_FIELDS: string[] = ["q", "resulttitle", "resultauthor", "authorid", "resultdescription", "resultsubject", "resultpublisher", "resultbestaccessright", "community", "collectedfromdatasourceid", "resulthostingdatasourceid", "resultdateofacceptance", @@ -73,7 +72,7 @@ export class SearchFields { }, ["pid"]: {name: "PID", type: "keyword", param: "pid", operator: "pd", equalityOperator: " = ", filterType: null}, ["resulthostingdatasourceid"]: { - name: "Hosting Content Provider", + name: "Source", type: "entity", param: "hostedBy", operator: "hs", @@ -89,7 +88,7 @@ export class SearchFields { filterType: "checkbox" }, ["instancetypename"]: { - name: "Type", + name: "Document Type", type: "vocabulary", param: "type", operator: "tp", @@ -105,7 +104,7 @@ export class SearchFields { filterType: "checkbox" }, ["community"]: { - name: "Community", + name: "Research Community", type: "refine", param: "community", operator: "cm", @@ -185,7 +184,7 @@ export class SearchFields { filterType: "range" }, ["resultbestaccessright"]: { - name: "Access Mode", + name: "Access", type: "vocabulary", param: "access", operator: "ac", @@ -217,7 +216,7 @@ export class SearchFields { filterType: null }, ["resulttypeid"]: { - name: "Result type", + name: "Type", type: "refine", param: "types", operator: "tp", @@ -233,7 +232,7 @@ export class SearchFields { filterType: "checkbox" }, ["sdg"]: { - name: "Sustainable Development Goals (SDG)", + name: "SDG", type: "refine", param: "sdg", operator: "sg", @@ -241,7 +240,7 @@ export class SearchFields { filterType: "checkbox" }, ["fos"]: { - name: "Fields of Science and Technology classification (FOS)", + name: "Field of Science", type: "refine", param: "fos", operator: "fs", From 77092a7e66aca8c6000de9f82c4da3fd1a039201 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Thu, 17 Mar 2022 16:13:55 +0200 Subject: [PATCH 2/3] [Library]: searchFields.ts: In previous commit changed name of "resulthostingdatasourceid" used in advanced search (Hosting Content Provider --> Source), instead of "resulthostingdatasource" used in refine filters (Content Provider --> Source). --- utils/properties/searchFields.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/properties/searchFields.ts b/utils/properties/searchFields.ts index 7953aeb8..fa5800b5 100644 --- a/utils/properties/searchFields.ts +++ b/utils/properties/searchFields.ts @@ -72,7 +72,7 @@ export class SearchFields { }, ["pid"]: {name: "PID", type: "keyword", param: "pid", operator: "pd", equalityOperator: " = ", filterType: null}, ["resulthostingdatasourceid"]: { - name: "Source", + name: "Hosting Content Provider", type: "entity", param: "hostedBy", operator: "hs", @@ -80,7 +80,7 @@ export class SearchFields { filterType: null }, ["resulthostingdatasource"]: { - name: "Content Provider", + name: "Source", type: "refine", param: "hostedBy", operator: "hs", From 95b56039e41885ba6322cd6e4a16684c49a434e0 Mon Sep 17 00:00:00 2001 From: argirok Date: Fri, 18 Mar 2022 13:14:07 +0200 Subject: [PATCH 3/3] add fos/sdg in advanced search, add autocomplete methods, add initial json files --- utils/properties/searchFields.ts | 6 +- .../ISVocabularies.service.ts | 60 +++++++++++++++++++ 2 files changed, 63 insertions(+), 3 deletions(-) diff --git a/utils/properties/searchFields.ts b/utils/properties/searchFields.ts index fa5800b5..417749a1 100644 --- a/utils/properties/searchFields.ts +++ b/utils/properties/searchFields.ts @@ -19,7 +19,7 @@ export class SearchFields { "resultbestaccessright", "community", "collectedfromdatasourceid", "resulthostingdatasourceid", "resultdateofacceptance", "relfunder", "relfundinglevel0_id", "relfundinglevel1_id", "relfundinglevel2_id", - "resultlanguagename", "relorganizationid", "pid", "relprojectid", "instancetypename"]; + "resultlanguagename", "relorganizationid", "pid", "relprojectid", "instancetypename", "fos", "sdg"]; public RESULT_FIELDS: { [key: string]: FieldDetails } = { ["q"]: {name: "All fields", type: "keyword", param: "q", operator: "op", equalityOperator: "=", filterType: null}, ["resulttitle"]: { @@ -233,7 +233,7 @@ export class SearchFields { }, ["sdg"]: { name: "SDG", - type: "refine", + type: "vocabulary", param: "sdg", operator: "sg", equalityOperator: " exact ", @@ -241,7 +241,7 @@ export class SearchFields { }, ["fos"]: { name: "Field of Science", - type: "refine", + type: "vocabulary", param: "fos", operator: "fs", equalityOperator: " exact ", diff --git a/utils/staticAutoComplete/ISVocabularies.service.ts b/utils/staticAutoComplete/ISVocabularies.service.ts index 98581d05..613cf0fd 100644 --- a/utils/staticAutoComplete/ISVocabularies.service.ts +++ b/utils/staticAutoComplete/ISVocabularies.service.ts @@ -78,6 +78,12 @@ export class ISVocabulariesService { //return this.getVocabularyFromService(vocabulary, properties); return from(this.getVocabularyFromServiceAsync(vocabulary, properties)); + } else if (field == "fos") { + vocabulary = "fos"; + return from(this.getVocabularyFromServiceAsync(vocabulary, properties)); + } else if (field == "sdg") { + vocabulary = "sdg"; + return from(this.getVocabularyFromServiceAsync(vocabulary, properties)); } return null; @@ -106,6 +112,9 @@ export class ISVocabulariesService { getVocabularyFromService(vocabularyName: string, properties: EnvProperties): Observable { let url = properties.vocabulariesAPI + vocabularyName; + if(vocabularyName == 'fos' || vocabularyName == 'sdg'){ + return this.getLocalVocabularyFromService(vocabularyName, properties); + } return this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url) //.map(res => res.json()) .pipe(map(res => res['terms'])) @@ -114,6 +123,57 @@ export class ISVocabulariesService { } + getLocalVocabularyFromService(vocabularyName: string, properties: EnvProperties): Observable { + if(vocabularyName == "sdg"){ + let url = "/assets/vocabulary/sdg.json"; + return this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url) + //.map(res => res.json()) + .pipe(map(res => res['sdg'])) + .pipe(map(res => this.parseSDGs(res))) + .pipe(catchError(this.handleError)); + }else if( vocabularyName == "fos"){ + let url = "/assets/vocabulary/fos.json"; + return this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url) + //.map(res => res.json()) + .pipe(map(res => res['fos'])) + .pipe(map(res => this.parseFOS(res))) + .pipe(catchError(this.handleError)); + } + } + + parseSDGs(data: any): AutoCompleteValue[] { + var array: AutoCompleteValue[] = [] + for (var i = 0; i < data.length; i++) { + var value: AutoCompleteValue = new AutoCompleteValue(); + value.id = data[i].id;//data[i].code; + value.label = data[i].label; + array.push(value); + } + return array; + } + + parseFOS(data: any): AutoCompleteValue[] { + let array: AutoCompleteValue[] = [] + for (let fos of data) { + let value: AutoCompleteValue = new AutoCompleteValue(); + value.id = fos.id;//data[i].code; + value.label = fos.label; + array.push(value); + for (let fos2 of fos.children) { + let value: AutoCompleteValue = new AutoCompleteValue(); + value.id = fos2.id;//data[i].code; + value.label = fos2.label; + array.push(value); + for (let fos3 of fos2.children) { + let value: AutoCompleteValue = new AutoCompleteValue(); + value.id = fos3.id;//data[i].code; + value.label = fos3.label; + array.push(value); + } + } + } + return array; + } parse(data: any, vocabularyName: string): AutoCompleteValue[] { var array: AutoCompleteValue[] = [] for (var i = 0; i < data.length; i++) {