[Trunk | Library]: fetchResearchResults.class.ts: Add methods 'getResultsForCommunity()' and 'getNumForCommunity()' - used in community first page.

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58810 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2020-05-31 11:28:12 +00:00
parent 1165a93c95
commit b454b318d0
1 changed files with 39 additions and 0 deletions

View File

@ -47,6 +47,45 @@ export class FetchResearchResults {
} }
} }
public getResultsForCommunity(resultType:string, communityId: string, page: number, size: number, properties:EnvProperties) {
this.searchUtils.status = this.errorCodes.LOADING;
this.subResults = this._searchResearchResultsService.search(resultType, "", "&fq=communityid=" + communityId, page, size, "resultdateofacceptance,descending", [], properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
this.results = data[1];
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
this.handleError("Error getting "+this.getEntityName(resultType,true)+" for community: "+communityId, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
}
);
}
public getNumForCommunity(resultType:string, communityId: string, properties:EnvProperties) {
this.searchUtils.status = this.errorCodes.LOADING;
this.subResults = this._searchResearchResultsService.countTotalResults(resultType, properties, "&fq=communityid=" + communityId).subscribe(
data => {
this.searchUtils.totalResults = data;
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
this.handleError("Error getting number of "+this.getEntityName(resultType,true)+" for community: "+communityId, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
}
);
}
public getResultsByKeyword(resultType:string, keyword:string, page: number, size: number, properties:EnvProperties, customFilter:SearchCustomFilter=null){ public getResultsByKeyword(resultType:string, keyword:string, page: number, size: number, properties:EnvProperties, customFilter:SearchCustomFilter=null){
var parameters = ""; var parameters = "";
if(keyword.length > 0){ if(keyword.length > 0){