Change SearchFields class format- apply changes to all search pages

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@44846 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2016-12-06 20:14:09 +00:00
parent 8a426cc52d
commit 04dae0c3f6
27 changed files with 249 additions and 214 deletions

View File

@ -30,8 +30,8 @@ export class AdvancedSearchDataProvidersComponent {
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
public searchFields:SearchFields = new SearchFields();
public fieldIds: string[] = this.searchFields.ADVANCED_DATAPROVIDER_PARAM;
public fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} = this.searchFields.DATAPROVIDER_FIELDS_MAP;
public fieldIds: string[] = this.searchFields.DATASOURCE_ADVANCED_FIELDS;
public fieldIdsMap= this.searchFields.DATASOURCE_FIELDS;
public selectedFields:AdvancedField[] = [];
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ;

View File

@ -31,9 +31,10 @@ export class AdvancedSearchDatasetsComponent {
public searchFields:SearchFields = new SearchFields();
public fieldIds: string[] = this.searchFields.ADVANCED_SEARCH_DATASET_PARAM;
public fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} = this.searchFields.DATASET_FIELDS_MAP;
public selectedFields:AdvancedField[] = [];
public fieldIds: string[] = this.searchFields.RESULT_ADVANCED_FIELDS;
public fieldIdsMap= this.searchFields.RESULT_FIELDS;
public selectedFields:AdvancedField[] = [];
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ;

View File

@ -29,8 +29,8 @@ export class AdvancedSearchOrganizationsComponent {
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
public searchFields:SearchFields = new SearchFields();
public fieldIds: string[] = this.searchFields.ADVANCED_SEARCH_ORGANIZATION_PARAM;
public fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} = this.searchFields.ORGANIZATION_FIELDS_MAP;
public fieldIds: string[] = this.searchFields.ORGANIZATION_ADVANCED_FIELDS;
public fieldIdsMap = this.searchFields.ORGANIZATION_FIELDS;
public selectedFields:AdvancedField[] = [];
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ;

View File

@ -31,8 +31,8 @@ export class AdvancedSearchPeopleComponent {
public searchFields:SearchFields = new SearchFields();
public fieldIds: string[] = this.searchFields.ADVANCED_SEARCH_PERSON_PARAM;
public fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} = this.searchFields.PERSON_FIELDS_MAP;
public fieldIds: string[] = this.searchFields.PERSON_ADVANCED_FIELDS;
public fieldIdsMap = this.searchFields.PERSON_FIELDS;
public selectedFields:AdvancedField[] = [];
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ;

View File

@ -30,8 +30,8 @@ export class AdvancedSearchProjectsComponent {
public searchFields:SearchFields = new SearchFields();
public fieldIds: string[] = this.searchFields.ADVANCED_PROJECTS_PARAM;
public fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} = this.searchFields.PROJECT_FIELDS_MAP;
public fieldIds: string[] = this.searchFields.PROJECT_ADVANCED_FIELDS;
public fieldIdsMap = this.searchFields.PROJECT_FIELDS;
public selectedFields:AdvancedField[] = [];
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ;

View File

@ -30,9 +30,9 @@ export class AdvancedSearchPublicationsComponent {
public searchFields:SearchFields = new SearchFields();
public fieldIds: string[] = this.searchFields.ADVANCED_SEARCH_PUBLICATIONS_PARAM;
public fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} = this.searchFields.PUBLICATION_FIELDS_MAP;
public selectedFields:AdvancedField[] = [];
public fieldIds: string[] = this.searchFields.RESULT_ADVANCED_FIELDS;
public fieldIdsMap= this.searchFields.RESULT_FIELDS;
public selectedFields:AdvancedField[] = [];
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ;
@ -56,6 +56,7 @@ export class AdvancedSearchPublicationsComponent {
this.searchPage.fieldIds = this.fieldIds;
this.searchPage.selectedFields = this.selectedFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.getSelectedFiltersFromUrl(params);
this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size);

View File

@ -33,9 +33,8 @@ export class SearchCompatibleDataprovidersComponent {
public sub: any; public subResults: any;
public _location:Location;
public searchFields:SearchFields = new SearchFields();
public refineFields: string[] = this.searchFields.DATAPROVIDER_INDEX;
public indexIdsMap: { [key:string]:string } = this.searchFields.DATAPROVIDER_INDEX_PARAM_MAP;
public fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} = this.searchFields.DATAPROVIDER_FIELDS_MAP;
public refineFields: string[] = this.searchFields.COMPATIBLE_DATAPROVIDER_FIELDS;
public fieldIdsMap= this.searchFields.DATASOURCE_FIELDS;
public _prefixQueryFields: {field:string,opName:string,opValue:string,values:string[]}[] =[{field:"compatibility",opName:"cm",opValue:"not", values:["UNKNOWN","hostedBy","notCompatible"]},{field:"type",opName:"tp",opValue:"not",values: ["other"]}];
// ["entityregistry","entityregistry::projects","entityregistry::repositories"]}];
public _prefixQuery: string = "";
@ -63,7 +62,6 @@ export class SearchCompatibleDataprovidersComponent {
public ngOnInit() {
this.searchPage.refineFields = this.refineFields;
this.searchPage.indexIdsMap = this.indexIdsMap;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.sub = this.route.queryParams.subscribe(params => {
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');

View File

@ -32,9 +32,8 @@ export class SearchEntityRegistriesComponent {
public sub: any; public subResults: any;
public _location:Location;
public searchFields:SearchFields = new SearchFields();
public refineFields: string[] = this.searchFields.DATAPROVIDER_INDEX;
public indexIdsMap: { [key:string]:string } = this.searchFields.DATAPROVIDER_INDEX_PARAM_MAP;
public fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} = this.searchFields.DATAPROVIDER_FIELDS_MAP;
public refineFields: string[] = this.searchFields.ENTITY_REGISTRIES_FIELDS;
public fieldIdsMap= this.searchFields.DATASOURCE_FIELDS;
public _prefixQueryFields: {field:string,opName:string,opValue:string,values:string[]}[] =[
{field:"type",opName:"tp",opValue:"and",values: ["other"]}];
// ["entityregistry","entityregistry::projects","entityregistry::repositories"]}];
@ -63,7 +62,6 @@ export class SearchEntityRegistriesComponent {
public ngOnInit() {
this.searchPage.refineFields = this.refineFields;
this.searchPage.indexIdsMap = this.indexIdsMap;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.sub = this.route.queryParams.subscribe(params => {
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');

View File

@ -38,14 +38,14 @@ import {SearchFields} from '../../utils/properties/searchFields';
<div *ngIf = "fieldIdsMap[selectedField.id].type == 'vocabulary'" class="input-group">
<static-autocomplete [(vocabularyId)] = selectedField.id [(list)] = this.fieldList[selectedField.id] [entityName] = "entityType" [selectedValue]=selectedField.value [showSelected]=true [placeHolderMessage] = "'Search for '+selectedField.name" [title] = "selectedField.name" [multipleSelections]=false (selectedValueChanged)="valueChanged($event,i)" (listUpdated) = "listUpdated($event,selectedField.id)"></static-autocomplete>
<static-autocomplete [(vocabularyId)] = selectedField.param [(list)] = this.fieldList[selectedField.id] [entityName] = "entityType" [selectedValue]=selectedField.value [showSelected]=true [placeHolderMessage] = "'Search for '+selectedField.name" [title] = "selectedField.name" [multipleSelections]=false (selectedValueChanged)="valueChanged($event,i)" (listUpdated) = "listUpdated($event,selectedField.id)"></static-autocomplete>
</div>
<div *ngIf = "fieldIdsMap[selectedField.id].type == 'refine'" class="input-group">
<static-autocomplete [(list)] = this.fieldList[selectedField.id] [entityName] = "entityType" [fieldName] = fieldIdsMap[selectedField.id].indexField [selectedValue]=selectedField.value [showSelected]=true [placeHolderMessage] = "'Search for '+selectedField.name" [title] = "selectedField.name" [multipleSelections]=false (selectedValueChanged)="valueChanged($event,i)" (listUpdated) = "listUpdated($event,selectedField.id)"></static-autocomplete>
<static-autocomplete [(list)] = this.fieldList[selectedField.id] [entityName] = "entityType" [fieldName] = [selectedField.id] [selectedValue]=selectedField.value [showSelected]=true [placeHolderMessage] = "'Search for '+selectedField.name" [title] = "selectedField.name" [multipleSelections]=false (selectedValueChanged)="valueChanged($event,i)" (listUpdated) = "listUpdated($event,selectedField.id)"></static-autocomplete>
</div>
<div *ngIf = "fieldIdsMap[selectedField.id].type == 'entity'" class="input-group">
<!--static-autocomplete [(list)] = this.fieldList[selectedField.id] [entityName] = "entityType" [fieldName] = fieldIdsMap[selectedField.id].indexField [selectedValue]=selectedField.value [showSelected]=true [placeHolderMessage] = "'Search for '+selectedField.name" [title] = "selectedField.name" [multipleSelections]=false (selectedValueChanged)="valueChanged($event,i)" (listUpdated) = "listUpdated($event,selectedField.id)"></static-autocomplete-->
<entities-autocomplete [entityType]=selectedField.id [selectedValue]=selectedField.value [showSelected]=true
<entities-autocomplete [entityType]=selectedField.param [selectedValue]=selectedField.value [showSelected]=true
[placeHolderMessage] = "'Search for '+selectedField.name" [title] = "selectedField.name" [multipleSelections]=false
(selectedValueChanged)="valueChanged($event,i)" (listUpdated) = "listUpdated($event,selectedField.id)"
@ -54,10 +54,10 @@ import {SearchFields} from '../../utils/properties/searchFields';
</div>
<div *ngIf = "fieldIdsMap[selectedField.id].type == 'boolean'" class="input-group">
<span class="input-group-addon">
<input type="radio" [(ngModel)]="selectedField.value" [name]=selectedField.id value="true">Yes<br>
<input type="radio" [(ngModel)]="selectedField.value" [name]=selectedField.param value="true">Yes<br>
</span>
<span class="input-group-addon">
<input type="radio" [(ngModel)]="selectedField.value" [name]=selectedField.id value="false">No<br>
<input type="radio" [(ngModel)]="selectedField.value" [name]=selectedField.param value="false">No<br>
</span>
</div>
</div>
@ -99,7 +99,8 @@ import {SearchFields} from '../../utils/properties/searchFields';
export class AdvancedSearchFormComponent {
@Input() entityType;
@Input() fieldIds: string[];
@Input() fieldIdsMap:{ [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} ;
@Input() fieldIdsMap;
//:{ [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} ;
@Input() selectedFields:AdvancedField[];
@Output() queryChange = new EventEmitter();
newFieldId:string;
@ -131,9 +132,9 @@ export class AdvancedSearchFormComponent {
console.info("add filter"+this.fieldIds[0]+this.fieldIdsMap[this.fieldIds[0]].name+this.fieldIdsMap[this.fieldIds[0]].type);
var type = this.fieldIdsMap[this.newFieldId].type;
if(type == "boolean"){
this.selectedFields.push(new AdvancedField(this.newFieldId, this.fieldIdsMap[this.newFieldId].name, type, "true", "and"));
this.selectedFields.push(new AdvancedField(this.newFieldId,this.fieldIdsMap[this.newFieldId].param, this.fieldIdsMap[this.newFieldId].name, type, "true", "and"));
}else{
this.selectedFields.push(new AdvancedField(this.newFieldId, this.fieldIdsMap[this.newFieldId].name, type, "", "and"));
this.selectedFields.push(new AdvancedField(this.newFieldId, this.fieldIdsMap[this.newFieldId].param,this.fieldIdsMap[this.newFieldId].name, type, "", "and"));
}
}

View File

@ -55,7 +55,7 @@ export class AdvancedSearchPageComponent {
@Input() entityType;
@Input() searchUtils:SearchUtilsClass = new SearchUtilsClass();
@Input() fieldIds: string[];
@Input() fieldIdsMap:{ [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} ;
@Input() fieldIdsMap;//:{ [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} ;
@Input() selectedFields:AdvancedField[];
@Input() simpleSearchUrl: string;
@ -72,19 +72,21 @@ export class AdvancedSearchPageComponent {
public getSelectedFiltersFromUrl(params){
for(var i=0; i< this.fieldIds.length ; i++){
var fieldId = this.fieldIds[i];
var operatorId = this.fieldIdsMap[fieldId].operator;
if(params[fieldId] != undefined && params[operatorId] != undefined) {
var values:string [] = decodeURIComponent(params[fieldId]).split(",");
var fieldparam = this.fieldIdsMap[fieldId].param;
var operatorId = this.getOperatorParameter(fieldparam);
if(params[fieldparam] != undefined && params[operatorId] != undefined) {
var values:string [] = decodeURIComponent(params[fieldparam]).split(",");
var operators:string [] = decodeURIComponent(params[operatorId]).split(",");
if(values.length == operators.length){
for(var j=0; j< values.length ; j++){
this.selectedFields.push(new AdvancedField(fieldId,this.fieldIdsMap[fieldId].name,this.fieldIdsMap[fieldId].type,values[j],operators[j]) )
this.selectedFields.push(new AdvancedField(fieldId,fieldparam,this.fieldIdsMap[fieldId].name,this.fieldIdsMap[fieldId].type,values[j],operators[j]) )
}
}
}
}
if(this.selectedFields.length == 0){
this.selectedFields.push(new AdvancedField(this.fieldIds[0],this.fieldIdsMap[this.fieldIds[0]].name,this.fieldIdsMap[this.fieldIds[0]].type,"","and"));
this.selectedFields.push(new AdvancedField(this.fieldIds[0],fieldparam,this.fieldIdsMap[this.fieldIds[0]].name,this.fieldIdsMap[this.fieldIds[0]].type,"","and"));
}
}
private createUrlParameters(includePage:boolean){
@ -105,8 +107,8 @@ export class AdvancedSearchPageComponent {
}
for(var i = 0; i< this.fieldIds.length; i++){
if(fields[this.fieldIds[i]]){
params+="&"+this.fieldIds[i]+"="+fields[this.fieldIds[i]].values.join()+
"&"+this.fieldIdsMap[this.fieldIds[i]].operator+"="+fields[this.fieldIds[i]].operators.join()
params+="&"+this.fieldIdsMap[this.fieldIds[i]].param+"="+fields[this.fieldIds[i]].values.join()+
"&"+this.getOperatorParameter(this.fieldIdsMap[this.fieldIds[i]].param)+"="+fields[this.fieldIds[i]].operators.join()
}
}
if(includePage && this.searchUtils.page != 1){
@ -124,9 +126,9 @@ export class AdvancedSearchPageComponent {
// if()
params += (countParams == 0 ? "" : this.selectedFields[i].operatorId) + " " + '"' + encodeURIComponent(this.selectedFields[i].value) + '"' + " ";
}else if(countParams == 0 && this.selectedFields[i].operatorId == "not"){
params += " "+ this.fieldIdsMap[this.selectedFields[i].id].indexField + " <> "+'"' + encodeURIComponent(this.selectedFields[i].value) +'"' + " ";
params += " "+ this.selectedFields[i].id + " <> "+'"' + encodeURIComponent(this.selectedFields[i].value) +'"' + " ";
}else{
params += (countParams == 0 ? "" : this.selectedFields[i].operatorId + " " ) + this.fieldIdsMap[this.selectedFields[i].id].indexField + this.fieldIdsMap[this.selectedFields[i].id].equalityOperator+'"' + encodeURIComponent(this.selectedFields[i].value) +'"' + " ";
params += (countParams == 0 ? "" : this.selectedFields[i].operatorId + " " ) + this.selectedFields[i].id + this.fieldIdsMap[this.selectedFields[i].id].equalityOperator+'"' + encodeURIComponent(this.selectedFields[i].value) +'"' + " ";
}
@ -165,4 +167,13 @@ export class AdvancedSearchPageComponent {
public updateBaseUrlWithParameters(){
this.baseURLWithParameters = this.searchUtils.baseUrl + this.createUrlParameters(false);
}
getOperatorParameter(parameter:string):string{
if(parameter.length > 2){
return parameter.substring(0,2);
}else if(parameter == "q"){
return "op";
}else{
return parameter+"Op";
}
}
}

View File

@ -15,14 +15,16 @@ export class Value{
}
export class AdvancedField{
public id: string; //
public param:string;
public name: string; //
public type: string = "keyword"; //keyword, static or dynamic
public value: string = '';
public operatorId: string;
public operatorName: string ="";
constructor(id:string,name:string, type:string, value:string,operator:string){
constructor(id:string,param:string,name:string, type:string, value:string,operator:string){
this.id = id;
this.param = param;
this.name = name;
this.type = type;
this.value = value;

View File

@ -68,15 +68,13 @@ export class SearchPageComponent {
@Input() filters = [];
@Input() type:string = "";
@Input() searchUtils:SearchUtilsClass = new SearchUtilsClass();
// @Input() totalResults: number = 0;
@Output() queryChange = new EventEmitter();
@Output() downloadClick = new EventEmitter();
@Input() baseUrl:string = '';
@Input() showResultCount:boolean = true;
@Input() showRefine:boolean = true;
@Input() refineFields = [];
public indexIdsMap: { [key:string]:string } ;
public fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }};
public fieldIdsMap;//: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }};
private searchFieldsHelper:SearchFields = new SearchFields();
private queryParameters: Map<string, string> = new Map<string,string>();
private baseURLWithParameters:string = '';
@ -112,7 +110,7 @@ export class SearchPageComponent {
var fq = "";
for(let value of values) {
countvalues++;
var paramId = this.indexIdsMap[filterId];
var paramId = this.fieldIdsMap[filterId].param;
parameters+='&' + paramId+ '='+ value+"&" + this.fieldIdsMap[paramId].operator + "="+((countvalues == 1)?"and":"or");
fq+=(fq.length > 0 ? " " + "or" + " ":"" ) + filterId +" exact " + this.quote(value) ;
}
@ -263,7 +261,6 @@ export class SearchPageComponent {
if(filter.countSelectedValues > 0){
var fq = "";
var count_selected=0;
var fieldId = this.indexIdsMap[filter.filterId];
for (let value of filter.values){
if(value.selected == true){
count_selected++;
@ -276,6 +273,7 @@ export class SearchPageComponent {
}
var doiQuery = "";
var keywordQuery = "";
console.info("keyyyyword::::"+ this.searchUtils.keyword )
if((this.searchUtils.keyword && this.searchUtils.keyword.length > 0)){
if((this.type == 'publication' ||this.type == 'dataset')){
var DOIs:string[] = DOI.getDOIsFromString(this.searchUtils.keyword);
@ -286,11 +284,15 @@ export class SearchPageComponent {
}
if(doisParams.length > 0){
doiQuery += "q=("+doisParams+")"
}else{
keywordQuery += "q=("+this.quote(this.searchUtils.keyword) +")"
}
}else{
keywordQuery += "q=("+this.quote(this.searchUtils.keyword) +")"
}
}
console.info("keyyyyword:::: doi:"+ doiQuery+ " keyword:"+keywordQuery )
return (doiQuery.length > 0 ? doiQuery:keywordQuery) + allFqs;
}
@ -300,7 +302,6 @@ export class SearchPageComponent {
if(filter.countSelectedValues > 0){
var count_selected=0;
var fq = "";
var fieldId = this.indexIdsMap[filter.filterId];
for (let value of filter.values){
if(value.selected == true){
count_selected++;
@ -377,10 +378,10 @@ export class SearchPageComponent {
// console.info("searchUtils.page goto = "+this.searchUtils.page);
this.queryParameters = new Map<string,string>();
var urlParameters = this.createUrlParameters(this.filters,true);
// console.info("urlParams : "+urlParameters);
console.info("urlParams : "+urlParameters);
this.updateBaseUrlWithParameters(this.filters);
var queryParameters = this.createSearchQueryParameters(this.filters);
// console.info("queryParams : "+queryParameters);
console.info("queryParams : "+queryParameters);
var indexQuery = this.createIndexQueryParameters(this.filters);
this.location.go(location.pathname,urlParameters);

View File

@ -30,9 +30,8 @@ export class SearchDataprovidersComponent {
public sub: any; public subResults: any;
public _location:Location;
public searchFields:SearchFields = new SearchFields();
public refineFields: string[] = this.searchFields.DATAPROVIDER_INDEX;
public indexIdsMap: { [key:string]:string } = this.searchFields.DATAPROVIDER_INDEX_PARAM_MAP;
public fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} = this.searchFields.DATAPROVIDER_FIELDS_MAP;
public refineFields: string[] = this.searchFields.DATASOURCE_REFINE_FIELDS;
public fieldIdsMap= this.searchFields.DATASOURCE_FIELDS;
public CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ],
"export":[]
};
@ -48,8 +47,7 @@ export class SearchDataprovidersComponent {
public ngOnInit() {
this.searchPage.refineFields = this.refineFields;
this.searchPage.indexIdsMap = this.indexIdsMap;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.sub = this.route.queryParams.subscribe(params => {
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');

View File

@ -33,9 +33,8 @@ export class SearchDatasetsComponent {
private sub: any;
private subResults: any;
private searchFields:SearchFields = new SearchFields();
private refineFields: string[] = this.searchFields.DATASET_INDEX;
private indexIdsMap: { [key:string]:string } = this.searchFields.DATASET_INDEX_PARAM_MAP;
private fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} = this.searchFields.DATASET_FIELDS_MAP;
public refineFields: string[] = this.searchFields.RESULT_REFINE_FIELDS;
public fieldIdsMap=this.searchFields.RESULT_FIELDS;
private urlParams : Map<string, string>;
private _location:Location;
@ -51,8 +50,7 @@ export class SearchDatasetsComponent {
public ngOnInit() {
this.searchPage.refineFields = this.refineFields;
this.searchPage.indexIdsMap = this.indexIdsMap;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.sub = this.route.queryParams.subscribe(params => {
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');

View File

@ -29,9 +29,8 @@ export class SearchOrganizationsComponent {
public sub: any;
public subResults: any;
public searchFields:SearchFields = new SearchFields();
public refineFields: string[] = this.searchFields.ORGANIZATION_INDEX;
public indexIdsMap: { [key:string]:string } = this.searchFields.ORGANIZATION_INDEX_PARAM_MAP;
public fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} = this.searchFields.ORGANIZATION_FIELDS_MAP;
public refineFields: string[] = this.searchFields.ORGANIZATION_REFINE_FIELDS;
public fieldIdsMap = this.searchFields.ORGANIZATION_FIELDS;
public urlParams : Map<string, string>;
public _location:Location;
@ -47,7 +46,6 @@ export class SearchOrganizationsComponent {
public ngOnInit() {
this.searchPage.refineFields = this.refineFields;
this.searchPage.indexIdsMap = this.indexIdsMap;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.sub = this.route.queryParams.subscribe(params => {

View File

@ -30,8 +30,8 @@ export class SearchPeopleComponent {
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
public sub: any;
public _location:Location;
public refineFields = [];
public searchFields:SearchFields = new SearchFields();
public refineFields = this.searchFields.PERSON_REFINE_FIELDS;
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;

View File

@ -29,9 +29,8 @@ export class SearchProjectsComponent {
public sub: any;
public subResults: any;
public searchFields:SearchFields = new SearchFields();
public refineFields: string[] = this.searchFields.PROJECT_INDEX;
public indexIdsMap: { [key:string]:string } = this.searchFields.PROJECT_INDEX_PARAM_MAP;
public fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} = this.searchFields.PROJECT_FIELDS_MAP;
public refineFields: string[] = this.searchFields.PROJECT_REFINE_FIELDS;
public fieldIdsMap = this.searchFields.PROJECT_FIELDS;
public urlParams : Map<string, string>;
public _location:Location;
@ -48,7 +47,6 @@ export class SearchProjectsComponent {
public ngOnInit() {
this.searchPage.refineFields = this.refineFields;
this.searchPage.indexIdsMap = this.indexIdsMap;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
console.info(" ngOnInit SearchProjectsComponent "+this.refineFields.length);
//get refine field filters from url parameters

View File

@ -34,9 +34,9 @@ export class SearchPublicationsComponent {
public sub: any;
public subResults: any;
public searchFields:SearchFields = new SearchFields();
public refineFields: string[] = this.searchFields.PUBLICATION_INDEX;
public indexIdsMap: { [key:string]:string } = this.searchFields.PUBLICATION_INDEX_PARAM_MAP;
public fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} = this.searchFields.PUBLICATION_FIELDS_MAP;
public refineFields: string[] = this.searchFields.RESULT_REFINE_FIELDS;
public fieldIdsMap=this.searchFields.RESULT_FIELDS;
//: { [key:string] :{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} = this.searchFields.PUBLICATION_FIELDS_MAP;
public urlParams : Map<string, string>;
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
public _location:Location;
@ -57,7 +57,6 @@ export class SearchPublicationsComponent {
public ngOnInit() {
this.searchPage.refineFields = this.refineFields;
this.searchPage.indexIdsMap = this.indexIdsMap;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.type = "publication";

View File

@ -32,7 +32,7 @@ export class SearchDataprovidersService {
return this.http.get(url)
.map(res => <any> res.json())
//.do(res => console.info(res))
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields)])
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")])
.do(res => {
this._cache.set(key, res);
});
@ -80,7 +80,7 @@ export class SearchDataprovidersService {
return this.http.get(url)
.map(res => <any> res.json())
//.do(res => console.info(res))
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields)])
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")])
.do(res => {
this._cache.set(key, res);
});
@ -103,7 +103,7 @@ export class SearchDataprovidersService {
return this.http.get(url)
.map(res => <any> res.json())
//.do(res => console.info(res))
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields)])
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")])
.do(res => {
this._cache.set(key, res);
});

View File

@ -34,7 +34,7 @@ export class SearchDatasetsService {
return this.http.get(url)
.map(res => <any> res.json())
//.do(res => console.info(res))
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields)])
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "dataset")])
.do(res => {
this._cache.set(key, res);
});
@ -62,7 +62,7 @@ export class SearchDatasetsService {
return this.http.get(url)
.map(res => <any> res.json())
//.do(res => console.info(res))
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields)])
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "dataset")])
.do(res => {
this._cache.set(key, res);
});

View File

@ -46,7 +46,7 @@ export class SearchOrganizationsService {
.do(res => {
this._cache.set(key, res);
});
//.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields)]);
//.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "organization")]);
}
quote(params: string):string {
@ -98,7 +98,7 @@ export class SearchOrganizationsService {
return this.http.get(url)
.map(res => <any> res.json())
//.do(res => console.info(res))
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields)])
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "organization")])
.do(res => {
this._cache.set(key, res);
});

View File

@ -36,7 +36,7 @@ export class SearchPeopleService {
return this.http.get(url)
.map(res => <any> res.json())
//.do(res => console.info(res))
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields)])
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "person")])
.do(res => {
this._cache.set(key, res);
});

View File

@ -37,7 +37,7 @@ export class SearchProjectsService {
return this.http.get(url)
.map(res => <any> res.json())
//.do(res => console.info(res))
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields)])
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "project")])
.do(res => {
this._cache.set(key, res);
});

View File

@ -36,7 +36,7 @@ export class SearchPublicationsService {
return this.http.get(url)
.map(res => <any> res.json())
//.do(res => console.info(res))
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields)])
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "publication")])
.do(res => {
this._cache.set(key, res);
});
@ -68,7 +68,7 @@ export class SearchPublicationsService {
return this.http.get(url)
.map(res => <any> res.json())
//.do(res => console.info(res))
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields)])
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "publication")])
.do(res => {
this._cache.set(key, res);
});

View File

@ -6,7 +6,7 @@ import { SearchFields} from '../../utils/properties/searchFields';
export class RefineResultsUtils {
public static parse (data, fields:string[]):Filter[] {
public static parse (data, fields:string[], entityType:string):Filter[] {
// var data = this.json.refineReuslts;
var searchFields:SearchFields = new SearchFields();
@ -15,7 +15,7 @@ export class RefineResultsUtils {
for(let j=0; j<fields.length; j++) {
var filter:Filter = new Filter();
filter.title = searchFields.FIELDS_NAMES[fields[j]];
filter.title = searchFields.getFieldName(fields[j],entityType);
filter.filterId = fields[j];
filter.originalFilterId = fields[j];
let field = data[fields[j]];

View File

@ -9,6 +9,9 @@ import {SearchDatasetsService} from '../services/searchDatasets.service';
import {ISVocabulariesService} from '../services/ISVocabularies.service';
import {Dates} from '../utils/string-utils.class';
import {SearchFields} from '../utils/properties/searchFields';
@Component({
selector: 'test',
template: `
@ -104,7 +107,43 @@ export class TestComponent {
}
);
console.info("do the test");
this.test();
console.info("after the test");
}
test(){
var sf:SearchFields = new SearchFields();
console.info("~~~RESULT");
this.checktables(sf.RESULT_REFINE_FIELDS,sf.RESULT_FIELDS,sf.RESULT_FIELDS);
this.checktables(sf.RESULT_ADVANCED_FIELDS,sf.RESULT_FIELDS,sf.RESULT_FIELDS);
console.info("~~~PR");
this.checktables(sf.PROJECT_REFINE_FIELDS,sf.PROJECT_FIELDS,sf.PROJECT_FIELDS);
this.checktables(sf.PROJECT_ADVANCED_FIELDS,sf.PROJECT_FIELDS,sf.PROJECT_FIELDS);
console.info("~~~DATAPR");
this.checktables(sf.DATASOURCE_REFINE_FIELDS,sf.DATASOURCE_FIELDS,sf.DATASOURCE_FIELDS);
this.checktables(sf.DATASOURCE_ADVANCED_FIELDS,sf.DATASOURCE_FIELDS,sf.DATASOURCE_FIELDS);
console.info("~~~ORG");
this.checktables(sf.ORGANIZATION_REFINE_FIELDS,sf.ORGANIZATION_FIELDS,sf.ORGANIZATION_FIELDS);
this.checktables(sf.ORGANIZATION_ADVANCED_FIELDS,sf.ORGANIZATION_FIELDS,sf.ORGANIZATION_FIELDS);
console.info("~~~PERSON");
this.checktables(sf.PERSON_REFINE_FIELDS,sf.PERSON_FIELDS,sf.PERSON_FIELDS);
this.checktables(sf.PERSON_ADVANCED_FIELDS,sf.PERSON_FIELDS,sf.PERSON_FIELDS);
}
checktables(fields,fieldsDetails,fieldsParam){
for(var i =0; i < fields.length; i++){
if(!fieldsDetails[fields[i]]){
console.info("!!!!"+fields[i]+ "field has to details");
}
}
}
login(){
localStorage.setItem("email",this.user.email);
localStorage.setItem("password",this.user.password);

View File

@ -1,123 +1,111 @@
export class SearchFields {
//main Entities
//PUBLICATIONS
public PUBLICATION_INDEX:string[] = ["instancetypename", "resultlanguagename", "community","relproject", "relfunderid",
"relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
"resultacceptanceyear","resultbestlicense","collectedfrom"];
public ADVANCED_SEARCH_PUBLICATIONS_PARAM:string[] = ["q","title","author","publisher","type", "lang","project", "funder", "funderlv0",
"funderlv1","funderlv2","community","access","pid","hostedBy","collectedFrom", "person"];
public PUBLICATION_INDEX_PARAM_MAP:{ [key:string]:string } = {["instancetypename"]:"type", ["resultlanguagename"]:"lang",["community"]:"community",
[ "relproject"]:"project",[ "relfunderid"]:"funder",
["relfundinglevel0_id"]:"funderlv0",["relfundinglevel1_id"]:"funderlv1",["relfundinglevel2_id"]:"funderlv2",
["resultacceptanceyear"]:"year",["resultbestlicense"]:"access",["resulthostingdatasourceid"]:"hostedBy",["collectedfrom"]:"collectedFrom",
["pid"]:"pid",["relpersonid"]:"person"};
public PUBLICATION_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} ={
["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null, equalityOperator: "="},
["title"]:{name:"Title",operator:"tt", type:"keyword" , indexField:"resulttitle", equalityOperator: "="},
["author"]:{name:"Author",operator:"at", type:"keyword", indexField:"relperson", equalityOperator: "="},
["publisher"]:{name:"Publisher",operator:"pb", type:"keyword", indexField:"resultpublisher", equalityOperator: "="},
["project"]:{name:"Project",operator:"po", type:"refine", indexField:"relproject", equalityOperator: " exact "},
["funder"]:{name:"Funder",operator:"fn", type:"refine", indexField:"relfunderid", equalityOperator: " exact "},
["funderlv0"]:{name:"Funding Stream",operator:"fn0", type:"refine", indexField:"relfundinglevel0_id", equalityOperator: " exact "},
["funderlv1"]:{name:"Funding Substream Level 1",operator:"fn1", type:"refine", indexField:"relfundinglevel1_id", equalityOperator: " exact "},
["funderlv2"]:{name:"Funding Substream Level 2",operator:"fn2", type:"refine", indexField:"relfundinglevel2_id", equalityOperator: " exact "},
["type"]:{name:"Type",operator:"tp", type:"vocabulary", indexField:"instancetypename", equalityOperator: " exact "},
["lang"]: {name:"Language",operator:"ln", type:"vocabulary", indexField:"resultlanguagename", equalityOperator: " exact "},
["community"]: {name:"Community",operator:"cm", type:"refine", indexField:"community", equalityOperator: " exact "},
["access"]: {name:"Access Mode",operator:"ac", type:"vocabulary", indexField:'resultbestlicense', equalityOperator: " exact "},
["hostedBy"]: {name:"Hosted by data provider",operator:"hs", type:"refine", indexField:"resulthostingdatasourceid", equalityOperator: " exact "},
["collectedFrom"]: {name:"Collected from data provider",operator:"cl", type:"refine", indexField:"collectedfrom", equalityOperator: " exact "},
["pid"]: {name:"PID",operator:"pd", type:"keyword", indexField:"pid", equalityOperator: " exact "},
["person"]: {name:"Person",operator:"pr", type:"entity", indexField:"relpersonid", equalityOperator: " exact "}
};
//RESULTS
//Used for datasets and publications
//In case Datasets should display different fields, use seperate tables for fields
public RESULT_REFINE_FIELDS = ["instancetypename", "resultlanguagename", "community","relproject", "relfunderid",
"relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
"resultacceptanceyear","resultbestlicense","collectedfrom"];
public RESULT_ADVANCED_FIELDS:string[] = ["q","resulttitle","relperson","resultpublisher","instancetypenameid",
"resultlanguageid", "community","relprojectid", "relfunderid",
"relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
"resultacceptanceyear","resultbestlicenseid","pid","resulthostingdatasourceid","collectedfromdatasourceid","relpersonid"];
public RESULT_FIELDS: { [key:string]:FieldDetails}={
["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
["resulttitle"]:{name:"Title", type:"keyword", param:"title", equalityOperator: "="},
["relperson"]:{name:"Author", type:"keyword", param:"author", equalityOperator: "="},
["resultpublisher"]:{name:"Publisher", type:"keyword", param:"publisher", equalityOperator: "="},
["pid"]:{name:"PID", type:"keyword", param:"pid", equalityOperator: " = "},
["resulthostingdatasourceid"]:{name:"Hosting Data Provider", type:"entity", param:"hostedBy", equalityOperator: " exact "},
["relpersonid"]:{name:"Person", type:"entity", param:"person", equalityOperator: " exact "},
["instancetypename"]:{name:"Type", type:"refine", param:"type", equalityOperator: " exact "},
["instancetypenameid"]:{name:"Type", type:"vocabulary", param:"type", equalityOperator: " exact "},
["resultlanguagename"]:{name:"Language", type:"refine", param:"lang", equalityOperator: " exact "},
["resultlanguageid"]:{name:"Language", type:"vocabulary", param:"lang", equalityOperator: " exact "},
["community"]:{name:"Community", type:"refine", param:"community", equalityOperator: " exact "},
["relproject"]:{name:"Project", type:"refine", param:"project", equalityOperator: " exact "},
["relprojectid"]:{name:"Project", type:"entity", param:"project", equalityOperator: " exact "},
["relfunderid"]:{name:"Funder", type:"refine", param:"funder", equalityOperator: " exact "},
["relfundinglevel0_id"]:{name:"Funding Stream", type:"refine", param:"funderlv0", equalityOperator: " exact "},
["relfundinglevel1_id"]:{name:"Funding Substream level 1", type:"refine", param:"funderlv1", equalityOperator: " exact "},
["relfundinglevel2_id"]:{name:"Funding Substream level 2", type:"refine", param:"funderlv2", equalityOperator: " exact "},
["resultacceptanceyear"]:{name:"Year", type:"refine", param:"year", equalityOperator: " exact "},
["resultbestlicense"]:{name:"Access Mode", type:"refine", param:"access", equalityOperator: " exact "},
["resultbestlicenseid"]:{name:"Access Mode", type:"vocabulary", param:"access", equalityOperator: " exact "},
["collectedfrom"]:{name:"Datasource", type:"refine", param:"datasource", equalityOperator: " exact "},
["collectedfromdatasourceid"]:{name:"Collected from Datasource", type:"enity", param:"collectedFrom", equalityOperator: " exact "}
};
//PROJECT
public PROJECT_INDEX:string[] = ["funderid","fundinglevel0_id","fundinglevel1_id","fundinglevel2_id","projectstartyear","projectendyear","projectecsc39"];
public ADVANCED_PROJECTS_PARAM:string[] = ["q", "acronym","title","keywords", "funder", "funderlv0",
"funderlv1","funderlv2","startyear","endyear","sc39","code","organization"];
public PROJECT_INDEX_PARAM_MAP:{ [key:string]:string } = {
[ "funderid"]:"funder", ["fundinglevel0_id"]:"funderlv0",["fundinglevel1_id"]:"funderlv1",["fundinglevel2_id"]:"funderlv2",
["projectstartyear"]:"startyear",["projectendyear"]:"endyear",["projectecsc39"]:"sc39",["relorganizationid"]:"organization"};
public PROJECT_REFINE_FIELDS:string[] = ["funderid","fundinglevel0_id","fundinglevel1_id",
"fundinglevel2_id","projectstartyear","projectendyear","projectecsc39"];
public PROJECT_ADVANCED_FIELDS:string[] = ["q","projectacronym","projecttitle","projectkeywords",
"funderid", "fundinglevel0_id","fundinglevel1_id", "fundinglevel2_id",
"projectstartyear","projectendyear","projectecsc39",
"projectcode","relorganizationid"];
public PROJECT_FIELDS: { [key:string]:FieldDetails}={
["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
["projectacronym"]:{name:"Acronym", type:"keyword", param:"acronym", equalityOperator: "="},
["projecttitle"]:{name:"Title", type:"keyword", param:"title", equalityOperator: "="},
["projectkeywords"]:{name:"Keywords", type:"keyword", param:"keywords", equalityOperator: "="},
public PROJECT_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} ={
["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null, equalityOperator: "="},
["keywords"]:{name:"Keywords",operator:"ky", type:"keyword" , indexField:"projectkeywords", equalityOperator: "="},
["acronym"]: {name:"Acronym",operator:"ar", type:"keyword", indexField:'projectacronym', equalityOperator: "="},
["title"]: {name:"Title",operator:"tt", type:"keyword", indexField:"projecttitle", equalityOperator: "="},
["funder"]:{name:"Funder",operator:"fn", type:"refine", indexField:"funderid", equalityOperator: " exact "},
["funderlv0"]:{name:"Funding Stream",operator:"fn0", type:"refine", indexField:"fundinglevel0_id", equalityOperator: " exact "},
["funderlv1"]:{name:"Funding Substream Level 1",operator:"fn1", type:"refine", indexField:"fundinglevel1_id", equalityOperator: " exact "},
["funderlv2"]:{name:"Funding Substream Level 2",operator:"fn2", type:"refine", indexField:"fundinglevel2_id", equalityOperator: " exact "},
["startyear"]:{name:"Start Year",operator:"sa", type:"keyword", indexField:"projectstartyear", equalityOperator: " exact "},
["endyear"]: {name:"End Year",operator:"ed", type:"keyword", indexField:"projectendyear", equalityOperator: " exact "},
["sc39"]: {name:"Special Clause 39",operator:"sc", type:"boolean", indexField:"projectecsc39", equalityOperator: " exact "},
["code"]: {name:"Project Code",operator:"cd", type:"keyword", indexField:"projectcode", equalityOperator: " exact "},
["organization"]: {name:"Organization",operator:"og", type:"entity", indexField:"relorganizationid", equalityOperator: " exact "}
["funderid"]:{name:"Funder", type:"refine", param:"funder", equalityOperator: " exact "},
["fundinglevel0_id"]:{name:"Funding Stream", type:"refine", param:"funderlv0", equalityOperator: " exact "},
["fundinglevel1_id"]:{name:"Funding Substream level 1", type:"refine", param:"funderlv1", equalityOperator: " exact "},
["fundinglevel2_id"]:{name:"Funding Substream level 2", type:"refine", param:"funderlv2", equalityOperator: " exact "},
["projectstartyear"]:{name:"Start Year", type:"refine", param:"startyear", equalityOperator: " exact "},
["projectendyear"]:{name:"End Year", type:"refine", param:"endyear", equalityOperator: " exact "},
["projectecsc39"]:{name:"Special Clause 39", type:"boolean", param:"sc39", equalityOperator: " exact "},
["projectcode"]:{name:"Project Code", type:"keyword", param:"code", equalityOperator: " exact "},
["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", equalityOperator: " exact "}
};
};
//DATAPROVIDERS
public DATAPROVIDER_INDEX:string[] = ["datasourcetypeuiname", "datasourceodlanguages", "datasourceodcontenttypes",
"datasourcecompatibilityname"];;
public ADVANCED_DATAPROVIDER_PARAM:string[] = ["q", "officialname",
"engname","subjects", "datasourcetype","lang","contenttype", "compatibility","organization"];
public DATAPROVIDER_INDEX_PARAM_MAP:{ [key:string]:string } = {
[ "datasourcetypeuiname"]:"type", [ "datasourcetypeid"]:"datasourcetype", ["datasourceodlanguages"]:"lang",["datasourceodcontenttypes"]:"contenttype",
["datasourcecompatibilityname"]:"compatibility",["relorganizationid"]:"organization"};
public DATASOURCE_REFINE_FIELDS:string[] = ["datasourcetypeuiname", "datasourceodlanguages", "datasourceodcontenttypes",
"datasourcecompatibilityname"];
public DATASOURCE_ADVANCED_FIELDS:string[] = ["q", "datasourceofficialname",
"datasourceenglishname","datasourceodsubjects", "datasourcetypeid","datasourceodlanguages",
"datasourceodcontenttypes", "datasourcecompatibilityid","relorganizationid"];
public DATAPROVIDER_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} ={
["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null, equalityOperator:"="},
["officialname"]:{name:"Official Name",operator:"of", type:"keyword", indexField:"datasourceofficialname", equalityOperator:"="},
["engname"]:{name:"English name",operator:"eg", type:"keyword", indexField:"datasourceenglishname", equalityOperator:"="},
["subjects"]: {name:"Subject",operator:"sb", type:"keyword", indexField:"datasourceodsubjects", equalityOperator:"="},
["type"]:{name:"Type",operator:"tp", type:"vocabulary" , indexField:"datasourcetypeuiname", equalityOperator: " exact "},
["datasourcetype"]:{name:"Type",operator:"tp", type:"vocabulary" , indexField:"datasourcetypeid", equalityOperator: " exact "},
["lang"]:{name:"Language",operator:"ln", type:"vocabulary", indexField:"datasourceodlanguages", equalityOperator: " exact "},
["contenttype"]:{name:"Content",operator:"cn", type:"refine", indexField:"datasourceodcontenttypes", equalityOperator: " exact "},
["compatibility"]:{name:"Compatibility Level",operator:"cm", type:"vocabulary", indexField:"datasourcecompatibilityname", equalityOperator: " exact "},
["organization"]: {name:"Organization",operator:"og", type:"entity", indexField:"relorganizationid", equalityOperator: " exact "}
};
public COMPATIBLE_DATAPROVIDER_FIELDS:string[] = ["type","compatibility"];
public ENTITY_REGISTRIES_FIELDS:string[] = ["datasourcetype","compatibility"];
//DATASET
public DATASET_INDEX:string[] = ["instancetypename", "resultlanguagename","relproject", //"community",
"relfunderid", "relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
"resultacceptanceyear","resultbestlicense","collectedfrom"];
public ADVANCED_SEARCH_DATASET_PARAM:string[] = ["q","title","author","publisher","type", "lang", "funder", "funderlv0",
"funderlv1","funderlv2","community","access","pid","hostedBy","collectedFrom","person"];
public DATASET_INDEX_PARAM_MAP:{ [key:string]:string } = {["instancetypename"]:"type", ["resultlanguagename"]:"lang",["community"]:"community",
[ "relproject"]:"project", [ "relfunderid"]:"funder",
["relfundinglevel0_id"]:"funderlv0",["relfundinglevel1_id"]:"funderlv1",["relfundinglevel2_id"]:"funderlv2",
["resultacceptanceyear"]:"year",["resultbestlicense"]:"access",["resulthostingdatasourceid"]:"hostedBy",["collectedfrom"]:"collectedFrom",
["pid"]:"pid",["relpersonid"]:"person"};
public DATASET_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} ={
["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null, equalityOperator: "="},
["title"]:{name:"Title",operator:"tt", type:"keyword" , indexField:"resulttitle", equalityOperator: "="},
["author"]:{name:"Author",operator:"at", type:"keyword", indexField:"relperson", equalityOperator: "="},
["publisher"]:{name:"Publisher",operator:"pb", type:"keyword", indexField:"resultpublisher", equalityOperator: "="},
["project"]:{name:"Project",operator:"po", type:"refine", indexField:"relproject", equalityOperator: " exact "},
["funder"]:{name:"Funder",operator:"fn", type:"refine", indexField:"relfunderid", equalityOperator: " exact "},
["funderlv0"]:{name:"Funding Stream",operator:"fn0", type:"refine", indexField:"relfundinglevel0_id", equalityOperator: " exact "},
["funderlv1"]:{name:"Funding Substream Level 1",operator:"fn1", type:"refine", indexField:"relfundinglevel1_id", equalityOperator: " exact "},
["funderlv2"]:{name:"Funding Substream Level 2",operator:"fn2", type:"refine", indexField:"relfundinglevel2_id", equalityOperator: " exact "},
["type"]:{name:"Type",operator:"tp", type:"vocabulary", indexField:"instancetypename", equalityOperator: " exact "},
["lang"]: {name:"Language",operator:"ln", type:"vocabulary", indexField:"resultlanguagename", equalityOperator: " exact "},
["community"]: {name:"Community",operator:"cm", type:"refine", indexField:"community", equalityOperator: " exact "},
["access"]: {name:"Access Mode",operator:"ac", type:"vocabulary", indexField:'resultbestlicense', equalityOperator: " exact "},
["hostedBy"]: {name:"Hosted by data provider",operator:"hs", type:"refine", indexField:"resulthostingdatasourceid", equalityOperator: " exact "},
["collectedFrom"]: {name:"Collected from data provider",operator:"cl", type:"refine", indexField:"collectedfrom", equalityOperator: " exact "},
["pid"]: {name:"PID",operator:"pd", type:"keyword", indexField:"pid", equalityOperator: " exact "},
["person"]: {name:"Person",operator:"pr", type:"entity", indexField:"relpersonid", equalityOperator: " exact "}
};
public DATASOURCE_FIELDS: { [key:string]:FieldDetails}={
["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
["datasourceofficialname"]:{name:"English name", type:"keyword", param:"officialname", equalityOperator: "="},
["datasourceenglishname"]:{name:"Title", type:"keyword", param:"engname", equalityOperator: "="},
["datasourceodsubjects"]:{name:"Subject", type:"keyword", param:"subjects", equalityOperator: "="},
["datasourcetypeuiid"]:{name:"Type", type:"refine", param:"type", equalityOperator: " exact "},
["datasourcetypeuiname"]:{name:"Type", type:"refine", param:"type", equalityOperator: " exact "},
["datasourcetypeid"]:{name:"Type", type:"vocabulary", param:"type", equalityOperator: " exact "},
["datasourceodlanguages"]:{name:"Language", type:"vocabulary", param:"lang", equalityOperator: " exact "},
["datasourceodcontenttypes"]:{name:"Content", type:"refine", param:"content", equalityOperator: " exact "},
["datasourcecompatibilityid"]:{name:"Compatibility Level", type:"vocabulary", param:"compatibility", equalityOperator: " exact "},
["datasourcecompatibilityname"]:{name:"Compatibility Level", type:"refine", param:"compatibility", equalityOperator: " exact "},
["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", equalityOperator: " exact "}
};
public COMPATIBLE_DATAPROVIDER_FIELDS:string[] = ["datasourcetypeuiid","datasourcecompatibilityid"];
public ENTITY_REGISTRIES_FIELDS:string[] = ["datasourcetypeid","datasourcecompatibilityid"];
//ORGANIZATION
public ORGANIZATION_REFINE_FIELDS:string[] = ["organizationcountryname"]
public ORGANIZATION_ADVANCED_FIELDS:string[] = ["q",
"organizationlegalname","organizationlegalshortname","organizationcountryid"];
public ORGANIZATION_FIELDS: { [key:string]:FieldDetails}={
["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
["organizationlegalname"]:{name:"Legal Name", type:"keyword", param:"name", equalityOperator: "="},
["organizationlegalshortname"]:{name:"Legal Short Name", type:"keyword", param:"shortname", equalityOperator: "="},
["organizationcountryid"]:{name:"Country", type:"vocabulary", param:"country", equalityOperator: "="},
["organizationcountryname"]:{name:"Country", type:"refine", param:"country", equalityOperator: "="}
};
public ORGANIZATION_INDEX:string[] = ["organizationcountryname"]//,"organizationeclegalbody"];
public ADVANCED_SEARCH_ORGANIZATION_PARAM:string[] = ["q","contenttype","compatibility","country","type"];
public ORGANIZATION_INDEX_PARAM_MAP:{ [key:string]:string } = {["organizationlegalname"]:"contenttype", ["organizationlegalshortname"]:"type",
@ -131,18 +119,15 @@ export class SearchFields {
};
//PERSON
public PERSON_INDEX:string[] = [];
public ADVANCED_SEARCH_PERSON_PARAM:string[] = ["q","surname","name","fullname"];
public PERSON_INDEX_PARAM_MAP:{ [key:string]:string } = {["personsecondnames"]:"surname", ["personfirstname"]:"name",
["personfullname"]:"fullname"};
public PERSON_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} ={
["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null, equalityOperator: "="},
["surname"]:{name:"Surname",operator:"sr", type:"keyword" , indexField:"personsecondnames", equalityOperator: "="},
["name"]:{name:"Name",operator:"nm", type:"keyword", indexField:"personfirstname", equalityOperator: "="},
["fullname"]:{name:"Full name",operator:"fl", type:"keyword", indexField:"personfullname", equalityOperator: "="}};
public PERSON_REFINE_FIELDS:string[] = [];
public PERSON_ADVANCED_FIELDS:string[] = ["q","personsecondnames","personfirstname","personfullname"];
public PERSON_FIELDS: { [key:string]:FieldDetails}={
["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
["personsecondnames"]:{name:"Surname", type:"keyword", param:"surname", equalityOperator: "="},
["personfirstname"]:{name:"First Name",type:"keyword", param:"name", equalityOperator: "="},
["personfullname"]:{name:"Full name", type:"keyword", param:"fullname", equalityOperator: "="}
};
public HIDDEN_FIELDS:string[] = ["fundinglevel0_id","fundinglevel1_id","fundinglevel2_id",
@ -152,21 +137,28 @@ export class SearchFields {
["fundinglevel1_id"]:"fundinglevel0_id", ["fundinglevel2_id"]:"fundinglevel1_id", ["relfundinglevel0_id"]:"relfunderid",
["relfundinglevel1_id"]:"relfundinglevel0_id", ["relfundinglevel2_id"]:"relfundinglevel1_id"};
// public PROJECT_PARAM_FIELDS:string[] = ["funder","fl0","fl1", "fl2", "start","end","sc39"];
public FIELDS_NAMES: { [key:string]:string } = {["relproject"]:"Project",["funderid"]:"Funder",["fundinglevel0_id"]:"Funding Stream",
["fundinglevel1_id"]:"Funding Substream Level 1", ["fundinglevel2_id"]:"Funding Substream Level 2", ["relfunderid"]:"Funder",
["relfundinglevel0_id"]:"Funding Stream",["relfundinglevel1_id"]:"Funding Substream Level 1", ["relfundinglevel2_id"]:"Funding Substream Level 2",
["instancetypename"]:"Type",["resultlanguagename"]: "Language",["community"]: "Community",["resultacceptanceyear"]:"Year",
["resultbestlicense"]:"Access Mode",["resulthostingdatasourceid"]:"Hosting Data provider",
["collectedfrom"]:"Data Provider", ["datasourcetypeuiname"]:"Type", ["datasourceodlanguages"]:"Language",
["datasourceodcontenttypes"]: "Content", ["datasourcecompatibilityname"]:"Compatibility Level", ["organizationcountryname"]:"Country",
["organizationeclegalbody"]:"Type",["projectstartyear"]:"Start Year",["projectendyear"]:"End Year",["projectecsc39"]:"Special Clause 39"};
public ADVANCED_SEARCH_OPERATORS:[{name:string, id:string}] = [{name:"AND",id:"and"},{name:"OR",id:"or"},{name:"NOT",id:"not"}];
constructor (){
}
getFieldName(fieldId:string,fieldType:string):string{
if(fieldType == "publication" || fieldType == "dataset"){
return this.RESULT_FIELDS[fieldId].name;
}else if(fieldType == "project"){
return this.PROJECT_FIELDS[fieldId].name;
}else if(fieldType == "organization"){
return this.ORGANIZATION_FIELDS[fieldId].name;
}else if(fieldType == "datasource"){
return this.DATASOURCE_FIELDS[fieldId].name;
}else{
return "UNDEFINED";
}
}
}
class FieldDetails{
name:string;
type:string;
param:string;
equalityOperator:string;
}