[develop | DONE | CHANGED]: Excluded (filter out) unidentified projects from search.
1. searchProjects.service.ts: Added filter &fq=(projectcode<>"unidentified") in methods "getProjectsforDataProvider()", "advancedSearchProjects()", "getProjectsForOrganizations()", "numOfSearchProjects2()". 2. organization.component.ts: In method call "searchProjectsService.getProjectsForOrganizations()" updated parameter for funder to be in fq instead of keyword query. 3. projects-in-modal.component.ts: In method "updateFilters()", format filterQuery to be in fq instead of keyword query. 4. entitySearch.service.ts: In method "search()", for type "project", added in the query &fq=(projectcode<>"unidentified").
This commit is contained in:
parent
1ac4365e05
commit
cc6b5aeffe
|
@ -116,7 +116,8 @@ export class ProjectsInModalComponent {
|
||||||
}
|
}
|
||||||
if (filterLimits.length > 0) {
|
if (filterLimits.length > 0) {
|
||||||
//this.filterQuery+=' and '+filter.filterId + ' exact '+ filterLimits + ' ';
|
//this.filterQuery+=' and '+filter.filterId + ' exact '+ filterLimits + ' ';
|
||||||
this.filterQuery += ' and ( ' + filterLimits + ' ) ';
|
// this.filterQuery += ' and ( ' + filterLimits + ' ) ';
|
||||||
|
this.filterQuery += '( ' + filterLimits + ' ) ';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -488,7 +488,7 @@ export class OrganizationComponent {
|
||||||
|
|
||||||
let filename: string = 'funder-project-' + this.contentFileName + '-report';
|
let filename: string = 'funder-project-' + this.contentFileName + '-report';
|
||||||
|
|
||||||
this.subscriptions.push(this._searchProjectsService.getProjectsForOrganizations(this.organizationId, ' and (funder exact "' + this.encodeURI(this.funderId) + '" ) ', 1, this.funderCount, [], this.properties).subscribe(
|
this.subscriptions.push(this._searchProjectsService.getProjectsForOrganizations(this.organizationId, '(funder exact "' + this.encodeURI(this.funderId) + '" ) ', 1, this.funderCount, [], this.properties).subscribe(
|
||||||
data => {
|
data => {
|
||||||
projects = data[1];
|
projects = data[1];
|
||||||
for (let index = 0; index < projects.length; index++) {
|
for (let index = 0; index < projects.length; index++) {
|
||||||
|
|
|
@ -34,14 +34,15 @@ export class SearchProjectsService {
|
||||||
}
|
}
|
||||||
getProjectsforDataProvider (datasourceId: string, page: number, size: number, properties:EnvProperties ):any {
|
getProjectsforDataProvider (datasourceId: string, page: number, size: number, properties:EnvProperties ):any {
|
||||||
let url = properties.searchResourcesAPIURL;
|
let url = properties.searchResourcesAPIURL;
|
||||||
var basicQuery = "(oaftype exact project) "
|
var basicQuery = "(oaftype exact project) ";
|
||||||
|
var filterQuery = "&fq=(projectcode<>\"unidentified\")";
|
||||||
url += "?query=";
|
url += "?query=";
|
||||||
if(datasourceId!= null && datasourceId != '' ) {
|
if(datasourceId!= null && datasourceId != '' ) {
|
||||||
url +=" ( "+basicQuery+ " ) " +" and (collectedfromdatasourceid exact \"" + datasourceId + "\" or resulthostingdatasourceid exact \""+ datasourceId + "\")";
|
url +=" ( "+basicQuery+ " ) " +" and (collectedfromdatasourceid exact \"" + datasourceId + "\" or resulthostingdatasourceid exact \""+ datasourceId + "\")";
|
||||||
}else{
|
}else{
|
||||||
url +=" ( "+basicQuery+ " ) ";
|
url +=" ( "+basicQuery+ " ) ";
|
||||||
}
|
}
|
||||||
|
url += filterQuery;
|
||||||
url += "&page="+(page-1)+"&size="+size;
|
url += "&page="+(page-1)+"&size="+size;
|
||||||
url += "&format=json";
|
url += "&format=json";
|
||||||
|
|
||||||
|
@ -53,6 +54,7 @@ export class SearchProjectsService {
|
||||||
// &type=projects
|
// &type=projects
|
||||||
let url = properties.searchAPIURLLAst+"resources2/?format=json";
|
let url = properties.searchAPIURLLAst+"resources2/?format=json";
|
||||||
// var basicQuery = "(oaftype exact project) "
|
// var basicQuery = "(oaftype exact project) "
|
||||||
|
var basicQuery = "&fq=(projectcode<>\"unidentified\")";
|
||||||
// url += "?query=";
|
// url += "?query=";
|
||||||
if(params!= null && params != '' ) {
|
if(params!= null && params != '' ) {
|
||||||
url +="&query=(" + params + ")";
|
url +="&query=(" + params + ")";
|
||||||
|
@ -66,6 +68,8 @@ export class SearchProjectsService {
|
||||||
if(refineQuery) {
|
if(refineQuery) {
|
||||||
url += "&" + refineQuery;
|
url += "&" + refineQuery;
|
||||||
}
|
}
|
||||||
|
// url += "&fq="+basicQuery;
|
||||||
|
url += basicQuery;
|
||||||
url += "&page="+(page-1)+"&size="+size;
|
url += "&page="+(page-1)+"&size="+size;
|
||||||
url += minRef ? "&minRef=true" : "";
|
url += minRef ? "&minRef=true" : "";
|
||||||
|
|
||||||
|
@ -80,11 +84,15 @@ export class SearchProjectsService {
|
||||||
let url = properties.searchResourcesAPIURL;
|
let url = properties.searchResourcesAPIURL;
|
||||||
var basicQuery = "(oaftype exact project) "
|
var basicQuery = "(oaftype exact project) "
|
||||||
url += "?query=";
|
url += "?query=";
|
||||||
if(filterquery!= null && filterquery != '' ) {
|
// if(filterquery!= null && filterquery != '' ) {
|
||||||
url +="( ( "+basicQuery+ " ) and (relorganizationid exact \"" + organizationId + "\")"+" " + filterquery + ")";
|
// url +="( ( "+basicQuery+ " ) and (relorganizationid exact \"" + organizationId + "\")"+" " + filterquery + ")";
|
||||||
}else{
|
// }else{
|
||||||
url +=" (( "+basicQuery+ " ) " +" and (relorganizationid exact \"" + organizationId + "\"))";
|
url +=" (( "+basicQuery+ " ) " +" and (relorganizationid exact \"" + organizationId + "\"))";
|
||||||
|
// }
|
||||||
|
if(filterquery) {
|
||||||
|
url += "&fq=" + filterquery;
|
||||||
}
|
}
|
||||||
|
url += "&fq=(projectcode<>\"unidentified\")";
|
||||||
if(refineFields!= null && refineFields.length > 0 ) {
|
if(refineFields!= null && refineFields.length > 0 ) {
|
||||||
url +="&refine=true";
|
url +="&refine=true";
|
||||||
for(let i=0; i< refineFields.length ; i++ ){
|
for(let i=0; i< refineFields.length ; i++ ){
|
||||||
|
@ -304,6 +312,8 @@ export class SearchProjectsService {
|
||||||
if(refineParams!= null && refineParams != '' ) {
|
if(refineParams!= null && refineParams != '' ) {
|
||||||
url += refineParams;
|
url += refineParams;
|
||||||
}
|
}
|
||||||
|
url += "&fq=(projectcode<>\"unidentified\")";
|
||||||
|
|
||||||
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
||||||
.pipe(map(res => res['meta']['total']));
|
.pipe(map(res => res['meta']['total']));
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,7 +148,7 @@ private fetch (link,id,oafEntityType,type, properties:EnvProperties ){
|
||||||
if(keyword!= null && keyword != '' ) {
|
if(keyword!= null && keyword != '' ) {
|
||||||
if(type=="project") {
|
if(type=="project") {
|
||||||
//name, title, acronym, grantid
|
//name, title, acronym, grantid
|
||||||
url += "fq="+'(projectcode_nt="'+keyword+'" ) or (fundershortname='+'"'+keyword+ '"'+') or (projectacronym="'+keyword+'" ) or (projecttitle="'+keyword+'")';
|
url += "fq="+'(projectcode_nt="'+keyword+'" ) or (fundershortname='+'"'+keyword+ '"'+') or (projectacronym="'+keyword+'" ) or (projecttitle="'+keyword+'")&fq=(projectcode<>"unidentified")';
|
||||||
} else if(type=="organization") {
|
} else if(type=="organization") {
|
||||||
//name fields
|
//name fields
|
||||||
url += "fq="+'(organizationlegalname="'+keyword+'" ) or (organizationlegalshortname='+'"'+keyword+ '")';
|
url += "fq="+'(organizationlegalname="'+keyword+'" ) or (organizationlegalshortname='+'"'+keyword+ '")';
|
||||||
|
|
Loading…
Reference in New Issue