From 04dae0c3f6a0b3e90b115952b354201b1c7141b5 Mon Sep 17 00:00:00 2001 From: "argiro.kokogiannaki" Date: Tue, 6 Dec 2016 20:14:09 +0000 Subject: [PATCH] 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 --- .../advancedSearchDataProviders.component.ts | 4 +- .../advancedSearchDatasets.component.ts | 7 +- .../advancedSearchOrganizations.component.ts | 4 +- .../advancedSearchPeople.component.ts | 4 +- .../advancedSearchProjects.component.ts | 4 +- .../advancedSearchPublications.component.ts | 7 +- .../compatibleDataProviders.component.ts | 6 +- .../entityRegistries.component.ts | 6 +- .../advancedSearchForm.component.ts | 17 +- .../advancedSearchPage.component.ts | 31 ++- .../searchUtils/searchHelperClasses.class.ts | 4 +- .../searchUtils/searchPage.component.ts | 17 +- .../simple/searchDataproviders.component.ts | 8 +- .../simple/searchDatasets.component.ts | 8 +- .../simple/searchOrganizations.component.ts | 6 +- .../simple/searchPeople.component.ts | 2 +- .../simple/searchProjects.component.ts | 6 +- .../simple/searchPublications.component.ts | 7 +- .../services/searchDataproviders.service.ts | 6 +- .../app/services/searchDatasets.service.ts | 4 +- .../services/searchOrganizations.service.ts | 4 +- .../src/app/services/searchPeople.service.ts | 2 +- .../app/services/searchProjects.service.ts | 2 +- .../services/searchPublications.service.ts | 4 +- .../servicesUtils/refineResults.class.ts | 4 +- portal-2/src/app/test/test.component.ts | 39 +++ .../src/app/utils/properties/searchFields.ts | 250 +++++++++--------- 27 files changed, 249 insertions(+), 214 deletions(-) diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchDataProviders.component.ts b/portal-2/src/app/searchPages/advanced/advancedSearchDataProviders.component.ts index 90ec3685..cbf23cf1 100644 --- a/portal-2/src/app/searchPages/advanced/advancedSearchDataProviders.component.ts +++ b/portal-2/src/app/searchPages/advanced/advancedSearchDataProviders.component.ts @@ -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 ; diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchDatasets.component.ts b/portal-2/src/app/searchPages/advanced/advancedSearchDatasets.component.ts index e88cf82c..ccc2ca24 100644 --- a/portal-2/src/app/searchPages/advanced/advancedSearchDatasets.component.ts +++ b/portal-2/src/app/searchPages/advanced/advancedSearchDatasets.component.ts @@ -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 ; diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations.component.ts b/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations.component.ts index 5937f22c..aed52d25 100644 --- a/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations.component.ts +++ b/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations.component.ts @@ -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 ; diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchPeople.component.ts b/portal-2/src/app/searchPages/advanced/advancedSearchPeople.component.ts index 9fc6d779..b5a19d83 100644 --- a/portal-2/src/app/searchPages/advanced/advancedSearchPeople.component.ts +++ b/portal-2/src/app/searchPages/advanced/advancedSearchPeople.component.ts @@ -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 ; diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchProjects.component.ts b/portal-2/src/app/searchPages/advanced/advancedSearchProjects.component.ts index 15802df2..1b1fb6ba 100644 --- a/portal-2/src/app/searchPages/advanced/advancedSearchProjects.component.ts +++ b/portal-2/src/app/searchPages/advanced/advancedSearchProjects.component.ts @@ -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 ; diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchPublications.component.ts b/portal-2/src/app/searchPages/advanced/advancedSearchPublications.component.ts index 776896c1..23295d76 100644 --- a/portal-2/src/app/searchPages/advanced/advancedSearchPublications.component.ts +++ b/portal-2/src/app/searchPages/advanced/advancedSearchPublications.component.ts @@ -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); diff --git a/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.component.ts b/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.component.ts index ee7a9ee7..d8273523 100644 --- a/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.component.ts +++ b/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.component.ts @@ -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']:''); diff --git a/portal-2/src/app/searchPages/dataProviders/entityRegistries.component.ts b/portal-2/src/app/searchPages/dataProviders/entityRegistries.component.ts index 5c646ffd..3b6fc19a 100644 --- a/portal-2/src/app/searchPages/dataProviders/entityRegistries.component.ts +++ b/portal-2/src/app/searchPages/dataProviders/entityRegistries.component.ts @@ -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']:''); diff --git a/portal-2/src/app/searchPages/searchUtils/advancedSearchForm.component.ts b/portal-2/src/app/searchPages/searchUtils/advancedSearchForm.component.ts index 298947a8..8700631c 100644 --- a/portal-2/src/app/searchPages/searchUtils/advancedSearchForm.component.ts +++ b/portal-2/src/app/searchPages/searchUtils/advancedSearchForm.component.ts @@ -38,14 +38,14 @@ import {SearchFields} from '../../utils/properties/searchFields';
- +
- +
-
- Yes
+ Yes
- No
+ No
@@ -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")); } } diff --git a/portal-2/src/app/searchPages/searchUtils/advancedSearchPage.component.ts b/portal-2/src/app/searchPages/searchUtils/advancedSearchPage.component.ts index 2e4fe18b..9bc11543 100644 --- a/portal-2/src/app/searchPages/searchUtils/advancedSearchPage.component.ts +++ b/portal-2/src/app/searchPages/searchUtils/advancedSearchPage.component.ts @@ -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"; + } + } } diff --git a/portal-2/src/app/searchPages/searchUtils/searchHelperClasses.class.ts b/portal-2/src/app/searchPages/searchUtils/searchHelperClasses.class.ts index e9c39835..1aa602c9 100644 --- a/portal-2/src/app/searchPages/searchUtils/searchHelperClasses.class.ts +++ b/portal-2/src/app/searchPages/searchUtils/searchHelperClasses.class.ts @@ -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; diff --git a/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts b/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts index 9159a6e5..a514207d 100644 --- a/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts +++ b/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts @@ -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 = new Map(); 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(); 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); diff --git a/portal-2/src/app/searchPages/simple/searchDataproviders.component.ts b/portal-2/src/app/searchPages/simple/searchDataproviders.component.ts index 6e6a644d..5e556c64 100644 --- a/portal-2/src/app/searchPages/simple/searchDataproviders.component.ts +++ b/portal-2/src/app/searchPages/simple/searchDataproviders.component.ts @@ -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']:''); diff --git a/portal-2/src/app/searchPages/simple/searchDatasets.component.ts b/portal-2/src/app/searchPages/simple/searchDatasets.component.ts index 90556e4a..99c6cc9b 100644 --- a/portal-2/src/app/searchPages/simple/searchDatasets.component.ts +++ b/portal-2/src/app/searchPages/simple/searchDatasets.component.ts @@ -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; 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']:''); diff --git a/portal-2/src/app/searchPages/simple/searchOrganizations.component.ts b/portal-2/src/app/searchPages/simple/searchOrganizations.component.ts index 46ac191b..cf87e360 100644 --- a/portal-2/src/app/searchPages/simple/searchOrganizations.component.ts +++ b/portal-2/src/app/searchPages/simple/searchOrganizations.component.ts @@ -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; 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 => { diff --git a/portal-2/src/app/searchPages/simple/searchPeople.component.ts b/portal-2/src/app/searchPages/simple/searchPeople.component.ts index 4e94611e..b2f3bcdf 100644 --- a/portal-2/src/app/searchPages/simple/searchPeople.component.ts +++ b/portal-2/src/app/searchPages/simple/searchPeople.component.ts @@ -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 ; diff --git a/portal-2/src/app/searchPages/simple/searchProjects.component.ts b/portal-2/src/app/searchPages/simple/searchProjects.component.ts index f93d9c89..e2316853 100644 --- a/portal-2/src/app/searchPages/simple/searchProjects.component.ts +++ b/portal-2/src/app/searchPages/simple/searchProjects.component.ts @@ -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; 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 diff --git a/portal-2/src/app/searchPages/simple/searchPublications.component.ts b/portal-2/src/app/searchPages/simple/searchPublications.component.ts index 41ed2a7a..fd1be699 100644 --- a/portal-2/src/app/searchPages/simple/searchPublications.component.ts +++ b/portal-2/src/app/searchPages/simple/searchPublications.component.ts @@ -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; @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"; diff --git a/portal-2/src/app/services/searchDataproviders.service.ts b/portal-2/src/app/services/searchDataproviders.service.ts index 3679a066..1e997c59 100644 --- a/portal-2/src/app/services/searchDataproviders.service.ts +++ b/portal-2/src/app/services/searchDataproviders.service.ts @@ -32,7 +32,7 @@ export class SearchDataprovidersService { return this.http.get(url) .map(res => 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 => 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 => 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); }); diff --git a/portal-2/src/app/services/searchDatasets.service.ts b/portal-2/src/app/services/searchDatasets.service.ts index a93a7752..85931a73 100644 --- a/portal-2/src/app/services/searchDatasets.service.ts +++ b/portal-2/src/app/services/searchDatasets.service.ts @@ -34,7 +34,7 @@ export class SearchDatasetsService { return this.http.get(url) .map(res => 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 => 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); }); diff --git a/portal-2/src/app/services/searchOrganizations.service.ts b/portal-2/src/app/services/searchOrganizations.service.ts index eb47b679..a89ac5ef 100644 --- a/portal-2/src/app/services/searchOrganizations.service.ts +++ b/portal-2/src/app/services/searchOrganizations.service.ts @@ -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 => 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); }); diff --git a/portal-2/src/app/services/searchPeople.service.ts b/portal-2/src/app/services/searchPeople.service.ts index 8cb7f891..32776dfa 100644 --- a/portal-2/src/app/services/searchPeople.service.ts +++ b/portal-2/src/app/services/searchPeople.service.ts @@ -36,7 +36,7 @@ export class SearchPeopleService { return this.http.get(url) .map(res => 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); }); diff --git a/portal-2/src/app/services/searchProjects.service.ts b/portal-2/src/app/services/searchProjects.service.ts index b94defb4..3e0fd126 100644 --- a/portal-2/src/app/services/searchProjects.service.ts +++ b/portal-2/src/app/services/searchProjects.service.ts @@ -37,7 +37,7 @@ export class SearchProjectsService { return this.http.get(url) .map(res => 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); }); diff --git a/portal-2/src/app/services/searchPublications.service.ts b/portal-2/src/app/services/searchPublications.service.ts index 0ed1c3be..b7cc0bee 100644 --- a/portal-2/src/app/services/searchPublications.service.ts +++ b/portal-2/src/app/services/searchPublications.service.ts @@ -36,7 +36,7 @@ export class SearchPublicationsService { return this.http.get(url) .map(res => 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 => 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); }); diff --git a/portal-2/src/app/services/servicesUtils/refineResults.class.ts b/portal-2/src/app/services/servicesUtils/refineResults.class.ts index 55238aee..ba4efc88 100644 --- a/portal-2/src/app/services/servicesUtils/refineResults.class.ts +++ b/portal-2/src/app/services/servicesUtils/refineResults.class.ts @@ -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