diff --git a/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts b/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts index bbfd64e4..8f8cad9a 100644 --- a/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts +++ b/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts @@ -157,7 +157,7 @@ export class SearchPageComponent { } var keyword = params['keyword']; - var doiQuery =(keyword.length > 0 && keyword.split(" ").length ==1 )?'or ((pidclassid exact doi) and (pid exact "'+ keyword+'"))':""; + var doiQuery =(keyword && keyword.length > 0 && keyword.split(" ").length ==1 )?'or ((pidclassid exact doi) and (pid exact "'+ keyword+'"))':""; var keywordQuery =(doiQuery.length > 0 )? "((" + this.quote(keyword) + ")" + doiQuery + ")":this.quote(keyword); // parameters += (keyword && keyword.length > 0?' and '+(this.type == 'publication' ||this.type == 'dataset' ?keywordQuery:keyword)+' ':''); // allFqs += ; diff --git a/portal-2/src/app/services/ISVocabularies.service.ts b/portal-2/src/app/services/ISVocabularies.service.ts index aadc8c98..a3a7ddcc 100644 --- a/portal-2/src/app/services/ISVocabularies.service.ts +++ b/portal-2/src/app/services/ISVocabularies.service.ts @@ -22,7 +22,7 @@ export class ISVocabulariesService { return this.getDatasetTypesJsonFile(); }else if( field == "access" && (entity == "publication" || entity == "dataset")){ return this.getAccessModeJsonFile(); - } else if( field == "type" && (entity == "dataprovider")){ + } else if( (field == "datasourcetype") && (entity == "dataprovider")){ return this.getDataProviderTypesJsonFile(); } else if( field == "compatibility" && (entity == "dataprovider")){ return this.getDataProviderCompatibilityJsonFile(); diff --git a/portal-2/src/app/services/entitySearch.service.ts b/portal-2/src/app/services/entitySearch.service.ts index 5fc616eb..4db2aec0 100644 --- a/portal-2/src/app/services/entitySearch.service.ts +++ b/portal-2/src/app/services/entitySearch.service.ts @@ -69,7 +69,7 @@ private fetch (link,id,oafEntityType,type){ let url = link+"/"+id; return this.http.get(url) .map(request => request.json()) - .do(res => console.info(res)) + // .do(res => console.info(res)) .map(request => this.parse(request,oafEntityType,type)); @@ -111,6 +111,12 @@ private fetch (link,id,oafEntityType,type){ } else { value.label = resData["fullname"]; } + }else if(resData["legalname"]){ + if(Array.isArray(resData["legalname"])) { + value.label = resData["legalname"][0]; + } else { + value.label = resData["legalname"]; + } } value.id = length > 1 ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier']; if(type=="project"){ diff --git a/portal-2/src/app/utils/entitiesAutoComplete.component.ts b/portal-2/src/app/utils/entitiesAutoComplete.component.ts index 1c69fa9c..5284e37d 100644 --- a/portal-2/src/app/utils/entitiesAutoComplete.component.ts +++ b/portal-2/src/app/utils/entitiesAutoComplete.component.ts @@ -22,9 +22,10 @@ import {EntitiesSearchService} from '../services/entitySearch.service'; -
+
+
    -
  • +
  • Select:
  • @@ -62,7 +63,7 @@ export class EntitiesAutocompleteComponent { private showInput = true; private sub; private done = false; - + private showLoading:boolean = false; private searchTermStream = new Subject(); filtered: Observable<{}> ; @@ -78,13 +79,16 @@ export class EntitiesAutocompleteComponent { if(this.entityType == "project" && this.funderId && this.funderId.length > 0){ this.filtered = this.searchTermStream .debounceTime(300).distinctUntilChanged() - .switchMap((term: string) => this._search.searchProjectsByFunder(term, this.funderId)); + .switchMap((term: string) => this._search.searchProjectsByFunder(term, this.funderId)); }else{ this.filtered = this.searchTermStream .debounceTime(300).distinctUntilChanged() - .switchMap((term: string) => - this._search.searchByType(term, this.entityType)); + .switchMap((term: string) => { + var results = this._search.searchByType(term, this.entityType); + this.showLoading = false; + return results; + }); this.getSelectedNameFromGivenId(); } @@ -111,7 +115,7 @@ export class EntitiesAutocompleteComponent { this.tries = 0; this.warningMessage = ""; this.searchTermStream.next(this.keyword); - + this.showLoading = true; } } diff --git a/portal-2/src/app/utils/properties/searchFields.ts b/portal-2/src/app/utils/properties/searchFields.ts index 57f80027..487e4fd6 100644 --- a/portal-2/src/app/utils/properties/searchFields.ts +++ b/portal-2/src/app/utils/properties/searchFields.ts @@ -36,10 +36,10 @@ export class SearchFields { 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"]; + "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"}; + ["projectstartyear"]:"startyear",["projectendyear"]:"endyear",["projectecsc39"]:"sc39",["relorganizationid"]:"organization"}; 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: "="}, @@ -53,17 +53,19 @@ export class SearchFields { ["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 "} + ["code"]: {name:"Project Code",operator:"cd", type:"keyword", indexField:"projectcode", equalityOperator: " exact "}, + ["organization"]: {name:"Organization",operator:"og", type:"entity", indexField:"relorganizationid", equalityOperator: " exact "} + }; //DATAPROVIDERS public DATAPROVIDER_INDEX:string[] = ["datasourcetypeuiid", "datasourceodlanguages", "datasourceodcontenttypes", "datasourcecompatibilityid"];; public ADVANCED_DATAPROVIDER_PARAM:string[] = ["q", "officialname", - "engname","subjects", "type","lang","contenttype", "compatibility"]; + "engname","subjects", "datasourcetype","lang","contenttype", "compatibility","organization"]; public DATAPROVIDER_INDEX_PARAM_MAP:{ [key:string]:string } = { [ "datasourcetypeuiid"]:"type", [ "datasourcetypeid"]:"datasourcetype", ["datasourceodlanguages"]:"lang",["datasourceodcontenttypes"]:"contenttype", - ["datasourcecompatibilityid"]:"compatibility"}; + ["datasourcecompatibilityid"]:"compatibility",["relorganizationid"]:"organization"}; 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:"="}, @@ -75,6 +77,7 @@ export class SearchFields { ["lang"]:{name:"Language",operator:"ln", type:"vocabulary", indexField:"datasourceodlanguages", equalityOperator: " exact "}, ["contenttype"]:{name:"Content Type",operator:"cn", type:"refine", indexField:"datasourceodcontenttypes", equalityOperator: " exact "}, ["compatibility"]:{name:"Compatibility Level",operator:"cm", type:"vocabulary", indexField:"datasourcecompatibilityid", equalityOperator: " exact "}, + ["organization"]: {name:"Organization",operator:"og", type:"entity", indexField:"relorganizationid", equalityOperator: " exact "} }; public COMPATIBLE_DATAPROVIDER_FIELDS:string[] = ["type","compatibility"];