[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:
Konstantina Galouni 2024-05-28 15:27:33 +03:00
parent 1ac4365e05
commit cc6b5aeffe
4 changed files with 19 additions and 8 deletions

View File

@ -116,7 +116,8 @@ export class ProjectsInModalComponent {
}
if (filterLimits.length > 0) {
//this.filterQuery+=' and '+filter.filterId + ' exact '+ filterLimits + ' ';
this.filterQuery += ' and ( ' + filterLimits + ' ) ';
// this.filterQuery += ' and ( ' + filterLimits + ' ) ';
this.filterQuery += '( ' + filterLimits + ' ) ';
}
}

View File

@ -488,7 +488,7 @@ export class OrganizationComponent {
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 => {
projects = data[1];
for (let index = 0; index < projects.length; index++) {

View File

@ -34,14 +34,15 @@ export class SearchProjectsService {
}
getProjectsforDataProvider (datasourceId: string, page: number, size: number, properties:EnvProperties ):any {
let url = properties.searchResourcesAPIURL;
var basicQuery = "(oaftype exact project) "
var basicQuery = "(oaftype exact project) ";
var filterQuery = "&fq=(projectcode<>\"unidentified\")";
url += "?query=";
if(datasourceId!= null && datasourceId != '' ) {
url +=" ( "+basicQuery+ " ) " +" and (collectedfromdatasourceid exact \"" + datasourceId + "\" or resulthostingdatasourceid exact \""+ datasourceId + "\")";
}else{
url +=" ( "+basicQuery+ " ) ";
}
url += filterQuery;
url += "&page="+(page-1)+"&size="+size;
url += "&format=json";
@ -53,6 +54,7 @@ export class SearchProjectsService {
// &type=projects
let url = properties.searchAPIURLLAst+"resources2/?format=json";
// var basicQuery = "(oaftype exact project) "
var basicQuery = "&fq=(projectcode<>\"unidentified\")";
// url += "?query=";
if(params!= null && params != '' ) {
url +="&query=(" + params + ")";
@ -66,6 +68,8 @@ export class SearchProjectsService {
if(refineQuery) {
url += "&" + refineQuery;
}
// url += "&fq="+basicQuery;
url += basicQuery;
url += "&page="+(page-1)+"&size="+size;
url += minRef ? "&minRef=true" : "";
@ -80,11 +84,15 @@ export class SearchProjectsService {
let url = properties.searchResourcesAPIURL;
var basicQuery = "(oaftype exact project) "
url += "?query=";
if(filterquery!= null && filterquery != '' ) {
url +="( ( "+basicQuery+ " ) and (relorganizationid exact \"" + organizationId + "\")"+" " + filterquery + ")";
}else{
// if(filterquery!= null && filterquery != '' ) {
// url +="( ( "+basicQuery+ " ) and (relorganizationid exact \"" + organizationId + "\")"+" " + filterquery + ")";
// }else{
url +=" (( "+basicQuery+ " ) " +" and (relorganizationid exact \"" + organizationId + "\"))";
// }
if(filterquery) {
url += "&fq=" + filterquery;
}
url += "&fq=(projectcode<>\"unidentified\")";
if(refineFields!= null && refineFields.length > 0 ) {
url +="&refine=true";
for(let i=0; i< refineFields.length ; i++ ){
@ -304,6 +312,8 @@ export class SearchProjectsService {
if(refineParams!= null && refineParams != '' ) {
url += refineParams;
}
url += "&fq=(projectcode<>\"unidentified\")";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.pipe(map(res => res['meta']['total']));
}

View File

@ -148,7 +148,7 @@ private fetch (link,id,oafEntityType,type, properties:EnvProperties ){
if(keyword!= null && keyword != '' ) {
if(type=="project") {
//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") {
//name fields
url += "fq="+'(organizationlegalname="'+keyword+'" ) or (organizationlegalshortname='+'"'+keyword+ '")';