[develop | DONE | FIXED]: Fixes on search projects for claims.
1. searchProjects.service.ts: Parse funder name if funder shortname is not available. 2. claimProjectSearchForm.component.ts: a. [BUG FIX] Set filter.countAllValues = filter.values.length; to show filter values without extra "view all" call b. [BUG FIX] Call projectService.advancedSearchProjects instead of projectService.searchProjects to get projects (/resources2 instead of /projects) to get 100 first values by default in facets.
This commit is contained in:
parent
c4180c7aa2
commit
438075f8df
|
@ -75,7 +75,8 @@ export class ClaimProjectsSearchFormComponent {
|
|||
this.prevFilters = this.filters;
|
||||
|
||||
//searchProjects (params: string, refineParams:string, page: number, size: number, refineFields:string[] , properties:EnvProperties ):any {
|
||||
this.sub = this._projectService.searchProjects(this.createOpenaireQueryParams(),(page==1)? this.refineFieldsQuery:null, page, size, (page==1)?this.refineFields:[], this.properties).subscribe(
|
||||
this.sub = this._projectService.advancedSearchProjects(this.createOpenaireQueryParams(), page, size, this.properties, (page == 1) ? this.refineFieldsQuery : null, (page == 1) ? this.refineFields : [], this.createOpenaireRefineQuery()).subscribe(
|
||||
// this.sub = this._projectService.searchProjects(this.createOpenaireQueryParams(),(page==1)? this.refineFieldsQuery:null, page, size, (page==1)?this.refineFields:[], this.properties).subscribe(
|
||||
data => {
|
||||
if (data != null) {
|
||||
this.openaireResultsPage = page;
|
||||
|
@ -205,9 +206,13 @@ export class ClaimProjectsSearchFormComponent {
|
|||
createOpenaireQueryParams(): string {
|
||||
let query = "";
|
||||
if (this.keyword.length > 0) {
|
||||
query += "q=" + StringUtils.quote(StringUtils.URIEncode(this.keyword));
|
||||
// query += "q=" + StringUtils.quote(StringUtils.URIEncode(this.keyword));
|
||||
query += StringUtils.quote(StringUtils.URIEncode(this.keyword));
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
createOpenaireRefineQuery(): string {
|
||||
/*if(this.startYear.length > 0 ){
|
||||
query+='&fq=projectstartyear exact \"'+this.startYear+'\"'
|
||||
}
|
||||
|
@ -236,9 +241,9 @@ export class ClaimProjectsSearchFormComponent {
|
|||
//selectedFromValue, selectedToValue, equalityOp, equalityOpFrom, equalityOpTo, filterOp ){
|
||||
allFqs += NewSearchPageComponent.createRangeFilterQuery(this.rangeFields[i], filter.selectedFromValue, filter.selectedToValue, " within ", ">=", "<=", "and")
|
||||
}
|
||||
return query+allFqs;
|
||||
|
||||
return allFqs + "&type=projects";
|
||||
}
|
||||
|
||||
public yearChanged() {
|
||||
this.search(this.page, this.size);
|
||||
|
||||
|
@ -273,7 +278,7 @@ export class ClaimProjectsSearchFormComponent {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
filter.countAllValues = filter.values.length;
|
||||
}
|
||||
if(filters.length == 0 ){
|
||||
for(let j=0; j< prevFilters.length ; j++) {
|
||||
|
@ -285,6 +290,7 @@ export class ClaimProjectsSearchFormComponent {
|
|||
filter.values.push(filterValue);
|
||||
}
|
||||
}
|
||||
filter.countAllValues = filter.values.length;
|
||||
filters.push(filter)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -230,7 +230,7 @@ export class SearchProjectsService {
|
|||
for(let z=0; z<fundingLength; z++) {
|
||||
let fundingData = Array.isArray(resData['fundingtree']) ? resData['fundingtree'][z] : resData['fundingtree'];
|
||||
if(fundingData.hasOwnProperty("funder")) {
|
||||
result['funderShortname'] = fundingData['funder'].shortname;
|
||||
result['funderShortname'] = fundingData['funder'].shortname ? fundingData['funder'].shortname : fundingData['funder'].name;
|
||||
result['funderId'] = fundingData['funder'].id;
|
||||
result['jurisdiction'] = (fundingData['funder']['id']['jurisdiction'] )?fundingData['funder']['id']['jurisdiction']:"";
|
||||
|
||||
|
|
Loading…
Reference in New Issue