[Library|Trunk]

Search Fields: use country field for organizations instead of organizationcountryname
	Advanced Search: Country autocomplete use country code instead of name



git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@56161 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2019-06-21 12:17:47 +00:00
parent 27a2ad0be5
commit e38db36e3e
2 changed files with 9 additions and 6 deletions

View File

@ -102,14 +102,14 @@ export class SearchFields {
//ORGANIZATION
public ORGANIZATION_REFINE_FIELDS:string[] = ["organizationcountryname"]
public ORGANIZATION_ADVANCED_FIELDS:string[] = ["q", "organizationlegalname","organizationlegalshortname","organizationcountryname"];
public ORGANIZATION_REFINE_FIELDS:string[] = ["country"]
public ORGANIZATION_ADVANCED_FIELDS:string[] = ["q", "organizationlegalname","organizationlegalshortname","country"];
public ORGANIZATION_FIELDS: { [key:string]:FieldDetails}={
["q"]:{name:"All fields", type:"keyword", param:"q", operator:"op", equalityOperator: "="},
["organizationlegalname"]:{name:"Legal Name", type:"keyword", param:"name", operator: "nm", equalityOperator: "="},
["organizationlegalshortname"]:{name:"Legal Short Name", type:"keyword", param:"shortname", operator: "so", equalityOperator: "="},
["organizationcountryname"]:{name:"Country", type:"vocabulary", param:"country", operator: "cu", equalityOperator: "="},
["country"]:{name:"Country", type:"vocabulary", param:"country", operator: "cu", equalityOperator: "="},
};
// public ORGANIZATION_INDEX:string[] = ["organizationcountryname"]//,"organizationeclegalbody"];
// public ADVANCED_SEARCH_ORGANIZATION_PARAM:string[] = ["q","contenttype","compatibility","country","type"];

View File

@ -82,16 +82,19 @@ export class ISVocabulariesService {
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())
.pipe(map(res => res['terms']))
.pipe(map(res => this.parse(res)))
.pipe(map(res => this.parse(res, vocabularyName)))
.pipe(catchError(this.handleError));
}
parse (data: any):AutoCompleteValue[] {
parse (data: any, vocabularyName: string):AutoCompleteValue[] {
var array:AutoCompleteValue[] =[]
for(var i = 0; i < data.length; i++){
var value:AutoCompleteValue = new AutoCompleteValue();
value.id = data[i].englishName;//data[i].code;
value.id = data[i].englishName;//data[i].code;
if(vocabularyName == 'dnet:countries.json'){ //use Country code instead of country name
value.id = data[i].code;
}
value.label = data[i].englishName;
array.push(value);
}