Datasource new refine fields datasourcethematic, datasourcejurisdiction

Present boolean filters as Yes/No
In selected filters add filter name for boolean filters
remove boolean sc39 from advanced search
This commit is contained in:
argirok 2022-05-30 12:44:39 +03:00
parent 86b48dc932
commit fd8f53507e
6 changed files with 59 additions and 46 deletions

View File

@ -47,7 +47,14 @@
<li *ngIf="!customFilter || (customFilter.isHiddenFilter && customFilter.valueId != value.id)"
class="">
<span class="uk-label uk-label-primary uk-flex uk-flex-middle">
<span class="uk-margin-small-right uk-width-expand uk-text-truncate">{{value.name}}</span>
<span
class="uk-margin-small-right uk-width-expand uk-text-truncate">
<span *ngIf="filter.type && filter.type == 'boolean' else noboolean">{{filter.title}}:
{{value.name=='true'?'Yes':'No'}}
</span>
<ng-template #noboolean>
{{value.name}}
</ng-template></span>
<button [class.uk-disabled]="disabled" (click)="removeFilter(value, filter)" class="uk-close uk-icon" [disabled]="disabled">
<icon name="close" flex="true" ratio="0.7"></icon>
</button>

View File

@ -24,7 +24,6 @@ import {properties} from "../../../../environments/environment";
import {AlertModal} from "../../utils/modal/alert";
import {Subscriber} from "rxjs";
import {IndexInfoService} from "../../utils/indexInfo.service";
import { Option } from '../../sharedComponents/input/input.component';
export interface SearchForm {
class: string,
@ -1508,7 +1507,7 @@ export class NewSearchPageComponent {
options = this.serviceTypeOptions;
}
if (options) {
this.resultTypes = {values:[],filterId:"type", countSelectedValues: 0, filterType: 'checkbox', originalFilterId: "", valueIsExact: true, title: "Type",filterOperator:"or"};
this.resultTypes = {values:[],filterId:"type", countSelectedValues: 0, filterType: 'checkbox', type:'checkBox', originalFilterId: "", valueIsExact: true, title: "Type",filterOperator:"or"};
for (let typeOption of Object.keys(options)) {
let type = typeOption;
if ( URLparams["type"] && URLparams["type"].indexOf(type)==-1 || !URLparams["type"]) {

View File

@ -53,7 +53,13 @@
(ngModelChange)="uniqueFilterChange(value)"/>
</span>
<span class="uk-margin-small-left">
{{_formatName(value)}}
<span *ngIf="filter.type && filter.type == 'boolean' else noboolean">
{{value.name=='true'?'Yes':'No'}}
</span>
<ng-template #noboolean>
{{_formatName(value)}}
</ng-template>
<span *ngIf="showResultCount">({{value.number|number}})</span>
</span>
</span>

View File

@ -8,6 +8,7 @@ export class Filter{
public filterOperator: string ='or';
public valueIsExact: boolean = true; // for search table view, if value is contained or is equal with column entry
public filterType: string = "checkbox";
public type?: string = "keyword";
public radioValue?: string = "";
// public uniqueValueIdSelected: string;
}

View File

@ -15,10 +15,12 @@ export class RefineResultsUtils {
for(let j=0; j<fields.length; j++) {
var filter:Filter = new Filter();
filter.title = searchFields.getFieldName(fields[j],entityType);
let fieldInfo = searchFields.getField(fields[j],entityType);
filter.title = fieldInfo?fieldInfo.name:"UNDEFINED";
filter.filterId = fields[j];
filter.originalFilterId = fields[j];
filter.filterType = searchFields.getFieldFilterType(fields[j], entityType, usedBy);
filter.filterType = fieldInfo?fieldInfo.filterType:"checkbox";
filter.type = fieldInfo?fieldInfo.type:"keyword";
filter.filterOperator = searchFields.getFieldOperator(fields[j]);
filter.radioValue = "";
//console.info("filter.title: "+filter.title+" filter.filterType: "+filter.filterType);

View File

@ -1,3 +1,5 @@
import {Filter} from "../../searchPages/searchUtils/searchHelperClasses.class";
export class SearchFields {
//main Entities
@ -257,7 +259,7 @@ export class SearchFields {
"fundinglevel2_id", "projectstartyear", "projectendyear", "projectecsc39"];
public PROJECT_ADVANCED_FIELDS: string[] = ["q", "projectacronym", "projecttitle", "projectkeywords",
"funder", "fundinglevel0_id", "fundinglevel1_id", "fundinglevel2_id",
"projectstartdate", "projectenddate", "projectecsc39",
"projectstartdate", "projectenddate",
"projectcode_nt", "relorganizationid", "collectedfromdatasourceid"];
public PROJECT_FIELDS: { [key: string]: FieldDetails } = {
["q"]: {name: "All fields", type: "keyword", param: "q", operator: "op", equalityOperator: "=", filterType: null},
@ -396,7 +398,8 @@ export class SearchFields {
//DATAPROVIDERS
// add Collected From Filter "collectedfromname"
public DATASOURCE_REFINE_FIELDS: string[] = ["datasourcetypeuiname", "datasourceodlanguages", "datasourceodcontenttypes",
"datasourcecompatibilityname", "country", "collectedfromname"];
"datasourcecompatibilityname", "country", "collectedfromname","datasourcethematic",
"datasourcejurisdiction"];
public DATASOURCE_ADVANCED_FIELDS: string[] = ["q", "datasourceofficialname",
"datasourceenglishname", "datasourceodsubjects", "datasourcetypename", "datasourceodlanguages",
"datasourceodcontenttypes", "datasourcecompatibilityname", "relorganizationid", "collectedfromdatasourceid"];
@ -514,6 +517,22 @@ export class SearchFields {
operator: "cu",
equalityOperator: "=",
filterType: "checkbox"
},
["datasourcethematic"]: {
name: "Thematic",
type: "boolean",
param: "thematic",
operator: "th",
equalityOperator: " exact ",
filterType: "radio"
},
["datasourcejurisdiction"]: {
name: "Jurisdiction",
type: "vocabulary",
param: "jurisdiction",
operator: "ju",
equalityOperator: "=",
filterType: "checkbox"
}
};
@ -526,7 +545,7 @@ export class SearchFields {
{"name": "country", "equalityOperator": " exact "},
{"name": "datasourcesubject", "equalityOperator": " all "}
];
public DEPOSIT_DATASOURCE_REFINE_FIELDS: string[] = ["datasourcetypename", "country", "datasourceodsubjects", "datasourceodcontenttypes", "datasourcecompatibilityname"];
public DEPOSIT_DATASOURCE_REFINE_FIELDS: string[] = ["datasourcetypename", "country", "datasourceodsubjects", "datasourceodcontenttypes", "datasourcecompatibilityname","datasourcethematic", "datasourcejurisdiction"];
public DEPOSIT_DATASOURCE_FIELDS: { [key: string]: FieldDetails } = {
["datasourcetypeuiname"]: {
@ -644,55 +663,34 @@ export class SearchFields {
constructor() {
}
getFieldName(fieldId: string, fieldType: string): string {
getField(fieldId: string, fieldType: string): any {
if (fieldType == "publication" || fieldType == "dataset" || fieldType == "software" || fieldType == "other" || fieldType == "result") {
return this.RESULT_FIELDS[fieldId].name;
return this.RESULT_FIELDS[fieldId];
} else if (fieldType == "project") {
return this.PROJECT_FIELDS[fieldId].name;
return this.PROJECT_FIELDS[fieldId];
} else if (fieldType == "organization") {
return this.ORGANIZATION_FIELDS[fieldId].name;
return this.ORGANIZATION_FIELDS[fieldId];
} else if (fieldType == "datasource" || fieldType == "dataprovider") {
return this.DATASOURCE_FIELDS[fieldId].name;
return this.DATASOURCE_FIELDS[fieldId];
} else if (fieldType == "service") {
return this.DATASOURCE_FIELDS[fieldId].name;
return this.DATASOURCE_FIELDS[fieldId];
} else {
return "UNDEFINED";
return null;
}
}
getFieldName(fieldId: string, fieldType: string): string {
let field = this.getField(fieldId, fieldType);
return field?field.name:"UNDEFINED";
}
getFieldFilterType(fieldId: string, fieldType: string, usedBy: string = "search"): string {
if (fieldType == "publication" || fieldType == "dataset" || fieldType == "software" || fieldType == "other" || fieldType == "result") {
return this.RESULT_FIELDS[fieldId].filterType;
} else if (fieldType == "project") {
return this.PROJECT_FIELDS[fieldId].filterType;
} else if (fieldType == "organization") {
return this.ORGANIZATION_FIELDS[fieldId].filterType;
} else if (fieldType == "datasource" || fieldType == "dataprovider") {
if (usedBy == "search") {
return this.DATASOURCE_FIELDS[fieldId].filterType;
} else if (usedBy == "deposit") {
return this.DEPOSIT_DATASOURCE_FIELDS[fieldId].filterType;
}
} else {
return "checkbox";
}
let field = this.getField(fieldId, fieldType);
return field?field.filterType:"checkbox";
}
getFieldParam(fieldId: string, fieldType: string): string {
if (fieldType == "publication" || fieldType == "dataset" || fieldType == "software" || fieldType == "other" || fieldType == "result") {
return this.RESULT_FIELDS[fieldId].param;
} else if (fieldType == "project") {
return this.PROJECT_FIELDS[fieldId].param;
} else if (fieldType == "organization") {
return this.ORGANIZATION_FIELDS[fieldId].param;
} else if (fieldType == "datasource" || fieldType == "dataprovider") {
return this.DATASOURCE_FIELDS[fieldId].param;
} else if (fieldType == "service") {
return this.DATASOURCE_FIELDS[fieldId].param;
} else {
return "UNDEFINED";
}
let field = this.getField(fieldId, fieldType);
return field?field.param:"UNDEFINED";
}
public static getParameterOrder(fieldId: string, params): number {
let fields = [];