diff --git a/searchPages/searchUtils/newSearchPage.component.ts b/searchPages/searchUtils/newSearchPage.component.ts index 15e4ce38..a5202f80 100644 --- a/searchPages/searchUtils/newSearchPage.component.ts +++ b/searchPages/searchUtils/newSearchPage.component.ts @@ -1468,23 +1468,25 @@ export class NewSearchPageComponent { }*/ 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: "Type",filterOperator:"or"}; - if (URLparams["type"]) { - let types = URLparams["type"]; - types = Array.isArray(types) ? types.join(',').split(",") : types.split(","); - for (let type of types) { - if (["publications", "datasets", "software", "other"].indexOf(StringUtils.unquote(type)) != -1 && this.resultTypeOptions[StringUtils.unquote(type)]) { - this.resultTypes.values.push({ - name: this.resultTypeOptions[StringUtils.unquote(type)].name, - id: StringUtils.unquote(type), - selected: true, - number: 0 - }); - this.resultTypes.countSelectedValues++; - } + for (let typeOption of Object.keys(this.resultTypeOptions)) { + let type = typeOption; + if ( URLparams["type"] && URLparams["type"].indexOf(type)==-1 || !URLparams["type"]) { + this.resultTypes.values.push({ + name: this.resultTypeOptions[StringUtils.unquote(type)].name, + id: StringUtils.unquote(type), + selected: false, + number: 0 + }); + }else{ + this.resultTypes.values.push({ + name: this.resultTypeOptions[StringUtils.unquote(type)].name, + id: StringUtils.unquote(type), + selected: true, + number: 0 + }); + this.resultTypes.countSelectedValues++; } - } - } this.URLCreatedFilters = filters;