Index: modules/uoa-services-portal/trunk/portal-2/src/app/services/entitySearch.service.ts
===================================================================
--- modules/uoa-services-portal/trunk/portal-2/src/app/services/entitySearch.service.ts	(revision 44739)
+++ modules/uoa-services-portal/trunk/portal-2/src/app/services/entitySearch.service.ts	(revision 44740)
@@ -13,52 +13,85 @@
     private api ="https://beta.services.openaire.eu/provision/mvc/vocabularies/";
     constructor(private http: Http, public _cache: CacheService) {}
 
-    searchByType(keyword:string,type:string,funderId:string){
-      if( type = "project"){
-          return this.searchProjectsByFunder(keyword,funderId);
+    searchProjectsByFunder(keyword:string, funderId:string):any {
+      let url =  OpenaireProperties.getSearchAPIURL()+"projects?"+((keyword && keyword.length > 0)?("q=" +keyword+"&op=and"):"")+"&funder="+funderId+"&fn=and&size=10&page=1";
+      return this.http.get(url).toPromise()
+      .then(request =>
+        {
+          request = request.json().results;
+          return this.parse(request,"oaf:project","project");
+        });
       }
-      // else if ( type == "hostedBy" ||  type == "collectedFrom"){
-      //     return this.searchDataproviders(keyword);
-      // }
+    searchByType(keyword:string,type:string){
+       if (type == "project"){
+         return  this.searchEntity(keyword,"projects","oaf:project","project");
+      }else if (type == "person"){
+        return  this.searchEntity(keyword,"people","oaf:person","person");
+      }else if (type == "dataset"){
+        return  this.searchEntity(keyword,"datasets","oaf:result","dataset");
+      }else if (type == "datasource"){
+        return  this.searchEntity(keyword,"datasources","oaf:datasource","datasource");
+      }else if (type == "publication"){
+        return  this.searchEntity(keyword,"publications","oaf:result","publication");
+      }else if (type == "organization"){
+        return  this.searchEntity(keyword,"organizations","oaf:organization","organization");
+
+      }
+
     }
-    searchProjectsByFunder(keyword:string, funderId:string):any {
-       let url =  OpenaireProperties.getSearchAPIURL()+"projects?"+((keyword && keyword.length > 0)?("q=" +keyword+"&op=and"):"")+"&funder="+funderId+"&fn=and&size=10&page=1";
-       return this.http.get(url).toPromise()
-                  .then(request =>
-                    {
-                      request = request.json().results;
-                      return this.parse(request,"oaf:project","project");
-                    });
+    fetchByType(id:string,type:string){
+       if (type == "project"){
+         return  this.fetchEntity(id,"projects","oaf:project","project");
+      }else if (type == "person"){
+        return  this.fetchEntity(id,"people","oaf:person","person");
+      }else if (type == "dataset"){
+        return  this.fetchEntity(id,"datasets","oaf:result","dataset");
+      }else if (type == "datasource"){
+        return  this.fetchEntity(id,"datasources","oaf:datasource","datasource");
+      }else if (type == "publication"){
+        return  this.fetchEntity(id,"publications","oaf:result","publication");
+      }else if (type == "organization"){
+        return  this.fetchEntity(id,"organizations","oaf:organization","organization");
+
       }
-    // searchDataproviders (keyword: string):any {
-    //
-    //           let link = OpenaireProperties.getSearchAPIURL()+"projects";
-    //           this.search(link,keyword,"oaf:datasource")
-    //
-    //       }
-    // searchProjects (keyword: string):any {
-    //
-    //     console.info("In searchProjects");
-    //
-    //     let link = OpenaireProperties.getSearchAPIURL()+"datasources";
-    //     this.search(link,keyword,"oaf:project")
-    //
-    // }
-    // search (link,keyword,type){
-    //   let url = link+"?";
-    //   if(keyword!= null && keyword != ''  ) {
-    //       url += "q="+ keyword+"&op=and";
-    //   }
-    //
-    //   url += "&page="+1+"&size="+10;
-    //
-    //
-    //   return this.http.get(url)
-    //               .map(res => <any> res.json())
-    //               //.do(res => console.info(res))
-    //               .map(res =>  this.parse(res['results'],type));
-    // }
-    parse(data: any,oafEntityType:string, type:string){
+
+    }
+private searchEntity (keyword: string,APIname:string,oafEntityType:string, type:string):any {
+      let link = OpenaireProperties.getSearchAPIURL()+APIname;
+      return this.search(link,keyword,oafEntityType,type)
+
+}
+private fetchEntity (id: string,APIname:string,oafEntityType:string, type:string):any {
+    let link = OpenaireProperties.getSearchAPIURL()+APIname;
+    return this.fetch(link,id,oafEntityType,type)
+}
+private fetch (link,id,oafEntityType,type){
+  let url = link+"/"+id;
+  return this.http.get(url)
+    .map(request => <any> request.json())
+    .do(res => console.info(res))
+    .map(request => <any>  this.parse(request,oafEntityType,type));
+
+
+
+}
+    private search (link,keyword,oafEntityType,type){
+      let url = link+"?";
+      if(keyword!= null && keyword != ''  ) {
+          url += "q="+ keyword+"&op=and";
+      }
+      //TODO  change page size when new API is ready
+      url += "&page="+(type == "publication"?0:1)+"&size="+10;
+      return this.http.get(url).toPromise()
+                 .then(request =>
+                   {
+                     request = request.json().results;
+                     return this.parse(request,oafEntityType,type);
+                   });
+
+
+    }
+    private parse(data: any,oafEntityType:string, type:string){
       var array:any =[]
       let length = Array.isArray(data) ? data.length : 1;
 
@@ -66,11 +99,18 @@
             let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity'][oafEntityType] : data['result']['metadata']['oaf:entity'][oafEntityType];
 
             var value:any={} ;
-
-            if(Array.isArray(resData['title'])) {
-                  value.label = resData['title'][0];
-            } else {
-                  value.label = resData['title'];
+            if(resData['title']){
+              if(Array.isArray(resData['title'])) {
+                    value.label = resData['title'][0];
+              } else {
+                    value.label = resData['title'];
+              }
+            }else if(resData["fullname"]){
+              if(Array.isArray(resData["fullname"])) {
+                    value.label = resData["fullname"][0];
+              } else {
+                    value.label = resData["fullname"];
+              }
             }
              value.id = length > 1 ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
              if(type=="project"){
@@ -86,8 +126,7 @@
                   }
 
              }
-             console.log("value:"+value);
-             array.push(value);
+              array.push(value);
         }
 
         return array;
Index: modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/searchUtils/advancedSearchForm.component.ts
===================================================================
--- modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/searchUtils/advancedSearchForm.component.ts	(revision 44739)
+++ modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/searchUtils/advancedSearchForm.component.ts	(revision 44740)
@@ -38,11 +38,20 @@
 
 
                     <div *ngIf = "fieldIdsMap[selectedField.id].type == 'vocabulary'" class="input-group">
-                    <static-autocomplete2  [(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-autocomplete2>
+                      <static-autocomplete2  [(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-autocomplete2>
                     </div>
                     <div *ngIf = "fieldIdsMap[selectedField.id].type == 'refine'" class="input-group">
-                    <static-autocomplete2 [(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-autocomplete2>
+                      <static-autocomplete2 [(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-autocomplete2>
                     </div>
+                    <div *ngIf = "fieldIdsMap[selectedField.id].type == 'entity'" class="input-group">
+                      <!--static-autocomplete2 [(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-autocomplete2-->
+                      <entities-autocomplete [entityType]=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)"
+
+                      ></entities-autocomplete>
+
+                    </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>
@@ -53,7 +62,10 @@
                   </div>
                 </div>
 
+                <!--entities-autocomplete [entityType]="person"   [selectedValue]="" [showSelected]=true
+                 [placeHolderMessage] = "'Search for persooon'" [title] = "Person"  [multipleSelections]=false
 
+                ></entities-autocomplete-->
                 <button type="button" class="btn btn-danger" *ngIf="selectedFields.length > 1" (click)="removeField(i)">
                     <span class="glyphicon glyphicon-minus" aria-hidden="true"></span>
                 </button>
Index: modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/searchUtils/advancedSearchPage.component.ts
===================================================================
--- modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/searchUtils/advancedSearchPage.component.ts	(revision 44739)
+++ modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/searchUtils/advancedSearchPage.component.ts	(revision 44740)
@@ -68,12 +68,10 @@
 
   @Output() queryChange  = new EventEmitter();
   constructor (private location: Location) {
-    console.log("Constr: AdvancedSearchPageComponent");
-  }
+   }
 
   ngOnInit() {
-    console.log("Init: AdvancedSearchPageComponent"+this.searchUtils.totalResults+this.searchUtils.baseUrl);
-    this.updateBaseUrlWithParameters();
+     this.updateBaseUrlWithParameters();
     //  this.searchUtils.totalResults = this.results.length;
   }
   public getSelectedFiltersFromUrl(params){
@@ -81,11 +79,9 @@
          var fieldId =  this.fieldIds[i];
          var operatorId =  this.fieldIdsMap[fieldId].operator;
           if(params[fieldId] != undefined && params[operatorId] != undefined) {
-            console.log(fieldId + " " + params[fieldId]+" Op: "+ operatorId + " "+ params[operatorId] );
-             var values:string [] = decodeURIComponent(params[fieldId]).split(",");
+              var values:string [] = decodeURIComponent(params[fieldId]).split(",");
              var operators:string [] = decodeURIComponent(params[operatorId]).split(",");
-             console.log(values + " " + " Op: "+ operators  );
-             if(values.length == operators.length){
+              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]) )
                }
@@ -139,8 +135,7 @@
       }
     }
 
-    console.info("Parameter:" + params);
-    return params;
+     return params;
 
   }
   clearFilters(){
@@ -147,9 +142,7 @@
   }
 
   goTo(page:number = 1){
-      console.info("goto");
-      //console.info("keyword: "+this.keyword);
-    this.searchUtils.page = page;
+     this.searchUtils.page = page;
     var urlParameters = this.createUrlParameters(true);
     var queryParameters = this.createQueryParameters();
     this.location.go(location.pathname,urlParameters);
@@ -170,10 +163,7 @@
   /*
   * Update the url with proper parameters. This is used as base url in Paging Component
   */
-  public updateBaseUrlWithParameters(){
-    console.info("Going to "+this.searchUtils.baseUrl + this.createUrlParameters(false));
-
+  public updateBaseUrlWithParameters(){ 
     this.baseURLWithParameters = this.searchUtils.baseUrl + this.createUrlParameters(false);
-    console.info("Updtae!!!"+this.baseURLWithParameters);
-  }
+   }
 }
Index: modules/uoa-services-portal/trunk/portal-2/src/app/utils/properties/searchFields.ts
===================================================================
--- modules/uoa-services-portal/trunk/portal-2/src/app/utils/properties/searchFields.ts	(revision 44739)
+++ modules/uoa-services-portal/trunk/portal-2/src/app/utils/properties/searchFields.ts	(revision 44740)
@@ -5,12 +5,12 @@
       "relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
       "resultacceptanceyear","resultbestlicenseid","resulthostingdatasourceid","collectedfromdatasourceid"];
       public ADVANCED_SEARCH_PUBLICATIONS_PARAM:string[] = ["q","title","author","publisher","type", "lang","project", "funder", "funderlv0",
-       "funderlv1","funderlv2","community","access","pid","hostedBy","collectedFrom"];
+       "funderlv1","funderlv2","community","access","pid","hostedBy","collectedFrom", "person"];
        public PUBLICATION_INDEX_PARAM_MAP:{ [key:string]:string } = {["instancetypenameid"]:"type", ["resultlanguageid"]:"lang",["communityid"]:"community",
        [ "relprojectid"]:"project",[ "relfunderid"]:"funder",
         ["relfundinglevel0_id"]:"funderlv0",["relfundinglevel1_id"]:"funderlv1",["relfundinglevel2_id"]:"funderlv2",
         ["resultacceptanceyear"]:"year",["resultbestlicenseid"]:"access",["resulthostingdatasourceid"]:"hostedBy",["collectedfromdatasourceid"]:"collectedFrom",
-        ["pid"]:"pid"};
+        ["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: "="},
@@ -27,8 +27,10 @@
       ["access"]: {name:"Access Mode",operator:"ac", type:"vocabulary", indexField:'resultbestlicenseid', 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:"collectedfromdatasourceid", equalityOperator: " exact "},
-      ["pid"]: {name:"PID",operator:"pd", type:"keyword", indexField:"pid", equalityOperator: " exact "}
+      ["pid"]: {name:"PID",operator:"pd", type:"keyword", indexField:"pid", equalityOperator: " exact "},
+      ["person"]: {name:"Person",operator:"pr", type:"entity", indexField:"relpersonid", equalityOperator: " exact "}
 
+
       };
       //PROJECT
 
@@ -85,12 +87,12 @@
          "relfunderid", "relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
          "resultacceptanceyear","resultbestlicenseid","resulthostingdatasourceid","collectedfromdatasourceid"];
          public ADVANCED_SEARCH_DATASET_PARAM:string[] = ["q","title","author","publisher","type", "lang", "funder", "funderlv0",
-          "funderlv1","funderlv2","community","access","pid","hostedBy","collectedFrom"];
+          "funderlv1","funderlv2","community","access","pid","hostedBy","collectedFrom","person"];
           public DATASET_INDEX_PARAM_MAP:{ [key:string]:string } = {["instancetypenameid"]:"type", ["resultlanguageid"]:"lang",["communityid"]:"community",
          [ "relprojectid"]:"project",  [ "relfunderid"]:"funder",
            ["relfundinglevel0_id"]:"funderlv0",["relfundinglevel1_id"]:"funderlv1",["relfundinglevel2_id"]:"funderlv2",
            ["resultacceptanceyear"]:"year",["resultbestlicenseid"]:"access",["resulthostingdatasourceid"]:"hostedBy",["collectedfromdatasourceid"]:"collectedFrom",
-           ["pid"]:"pid"};
+           ["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: "="},
@@ -107,7 +109,8 @@
          ["access"]: {name:"Access Mode",operator:"ac", type:"vocabulary", indexField:'resultbestlicenseid', 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:"collectedfromdatasourceid", equalityOperator: " exact "},
-         ["pid"]: {name:"PID",operator:"pd", type:"keyword", indexField:"pid", equalityOperator: " exact "}
+         ["pid"]: {name:"PID",operator:"pd", type:"keyword", indexField:"pid", equalityOperator: " exact "},
+         ["person"]: {name:"Person",operator:"pr", type:"entity", indexField:"relpersonid", equalityOperator: " exact "}
          };
 
 
Index: modules/uoa-services-portal/trunk/portal-2/src/app/utils/entitiesAutoComplete.component.ts
===================================================================
--- modules/uoa-services-portal/trunk/portal-2/src/app/utils/entitiesAutoComplete.component.ts	(revision 44739)
+++ modules/uoa-services-portal/trunk/portal-2/src/app/utils/entitiesAutoComplete.component.ts	(revision 44740)
@@ -47,7 +47,6 @@
     @Output() addItem = new EventEmitter(); // when selected list  changes update parent component
     @Output() selectedValueChanged = new EventEmitter(); // when changed  a method for filtering will be called
     @Input() public list = []; // the entries resulted after filtering function
-
     @Input() public selected = []; // the entries selected from user
     @Input() public keywordlimit = 3; // the minimum length of keyword
     @Input() public showSelected = true; // the minimum length of keyword
@@ -54,10 +53,8 @@
     @Input() public multipleSelections:boolean = true;
     @Input() public allowDuplicates:boolean = false;
     @Input() public selectedValue:string = '';
+    @Input() public keyword = '';
 
-
-    @Input() public keyword = '';
-    @Input() public type = 'search' //search, result, context, project
     private warningMessage = "";
     private infoMessage = "";
 
@@ -68,31 +65,34 @@
 
     private searchTermStream = new Subject<string>();
     filtered: Observable<{}> ;
-    //  = this.searchTermStream
-    // .debounceTime(300).distinctUntilChanged()
-    // .switchMap((term: string) =>   this._search.searchProjectsByFunder(term, this.funderId));
 
-    @Input() public funderId:string ="0";
-    @Input() public entityName:string ;
+    @Input() public funderId:string;
+    @Input() public entityType:string ;
 
     constructor (private _search:EntitiesSearchService, private myElement: ElementRef) {
-      // if(this.entityName == "project" ){
-      //   this.filtered  = this.searchTermStream
-      //   .debounceTime(300).distinctUntilChanged()
-      //   .switchMap((term: string) =>   this._search.searchProjectsByFunder(term, this.funderId));
-      // }
 
+
     }
+
     ngOnInit () {
-      if(this.entityName == "project" ){
+       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));
+      }else{
+
+        this.filtered  = this.searchTermStream
+        .debounceTime(300).distinctUntilChanged()
+        .switchMap((term: string) =>
+        this._search.searchByType(term, this.entityType));
+        this.getSelectedNameFromGivenId();
       }
 
     }
     ngOnDestroy(){
-
+      if(this.sub && this.sub != undefined){
+        this.sub.unsubscribe();
+      }
     }
 
     search() {
@@ -107,7 +107,7 @@
           this.tries = 0;
         }
       }else{
-        console.info("doo the search "+this.keyword );
+
         this.tries = 0;
         this.warningMessage = "";
         this.searchTermStream.next(this.keyword);
@@ -159,7 +159,6 @@
         });
 
       }
-      console.log("selected"+this.selected.length  );
 
     }
     private checkIfExists(item:any,list):number{
@@ -195,17 +194,17 @@
 
     }
     private getSelectedNameFromGivenId(){
-      if(this.list == null ){
-        return;
-      }
-      for( var i = 0; i < this.list.length; i++){
-        if(this.list[i].id == this.selectedValue){
-          this.selectedValue = this.list[i].label;
-          this.selected.push(this.list[i]);
+      if(this.selectedValue && this.selectedValue.length > 0 ){
+
+
+      this.sub = this._search.fetchByType(this.selectedValue,this.entityType).subscribe(
+        data => {
+          this.selected.push( data[0]);
           this.showInput = false;
-        }
-      }
+         },
+        err => console.error("An error occured"));
     }
+  }
 
     handleClick(event){
      var clickedComponent = event.target;
Index: modules/uoa-services-portal/trunk/portal-2/src/app/claimPages/claim-utils/claimProject.component.ts
===================================================================
--- modules/uoa-services-portal/trunk/portal-2/src/app/claimPages/claim-utils/claimProject.component.ts	(revision 44739)
+++ modules/uoa-services-portal/trunk/portal-2/src/app/claimPages/claim-utils/claimProject.component.ts	(revision 44740)
@@ -24,7 +24,7 @@
 
                   </ul>
                 </div>
-                <entities-autocomplete entityName="project" [funderId]="selectedFunderId"  [allowDuplicates]=true [showSelected]=false [placeHolderMessage] = "'Search for Projects'" title = "Projects:"  [multipleSelections]=true  (addItem) = "select($event)" ></entities-autocomplete>
+                <entities-autocomplete entityType="project" [funderId]="selectedFunderId"  [allowDuplicates]=true [showSelected]=false [placeHolderMessage] = "'Search for Projects'" title = "Projects:"  [multipleSelections]=true  (addItem) = "select($event)" ></entities-autocomplete>
 
 
               </div>
