diff --git a/searchPages/searchUtils/searchPage.component.ts b/searchPages/searchUtils/searchPage.component.ts index 05c4645f..47e34f8a 100644 --- a/searchPages/searchUtils/searchPage.component.ts +++ b/searchPages/searchUtils/searchPage.component.ts @@ -185,11 +185,13 @@ export class SearchPageComponent { let values = (StringUtils.URIDecode(this.queryParameters.get(filterId))).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1); var countvalues = 0; var fq = ""; + let filterOp: string = this.searchFieldsHelper.getFieldOperator(filterId); + console.info(filterId, filterOp); for(let value of values) { countvalues++; var paramId = this.fieldIdsMap[filterId].param; // parameters+='&' + paramId+ '='+ value;//+"&" + this.fieldIdsMap[paramId].operator + "="+((countvalues == 1)?"and":"or"); - fq+=(fq.length > 0 ? " " + "or" + " ":"" ) + filterId +" exact " +(value); + fq+=(fq.length > 0 ? " " + filterOp + " ":"" ) + filterId +" exact " +(value); } if(countvalues > 0){ fq="&fq="+StringUtils.URIEncode(fq); @@ -247,11 +249,13 @@ export class SearchPageComponent { if(params[filterId] != undefined) { this.queryParameters.set(filterId,decodeURIComponent(params[filterId])); let values = (decodeURIComponent(this.queryParameters.get(filterId))).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1); - var countvalues = 0 + var countvalues = 0; + let filterOp: string = this.searchFieldsHelper.getFieldOperator(filterId); + console.info(filterId, filterOp); for(let value of values) { countvalues++; // parameters+= ((countvalues == 1)?" and (":" or ")+ filterId+ '='+ value; - fq+=(fq.length > 0 ? " " + "or" + " ":"" ) + filterId + " exact " + value;//StringUtils.quote(value); + fq+=(fq.length > 0 ? " " + filterOp + " ":"" ) + filterId + " exact " + value;//StringUtils.quote(value); } // parameters+= " ) "; if(countvalues > 0){ diff --git a/services/servicesUtils/refineResults.class.ts b/services/servicesUtils/refineResults.class.ts index 6068e522..01999671 100644 --- a/services/servicesUtils/refineResults.class.ts +++ b/services/servicesUtils/refineResults.class.ts @@ -19,6 +19,7 @@ export class RefineResultsUtils { filter.filterId = fields[j]; filter.originalFilterId = fields[j]; filter.valueIsUnique = searchFields.fieldHasUniqueValue(fields[j], entityType, usedBy); + filter.filterOperator = searchFields.getFieldOperator(fields[j]); //console.info("filter.title: "+filter.title+" filter.valueIsUnique: "+filter.valueIsUnique); let field = data[fields[j]]; diff --git a/utils/properties/searchFields.ts b/utils/properties/searchFields.ts index 474f9298..6802fceb 100644 --- a/utils/properties/searchFields.ts +++ b/utils/properties/searchFields.ts @@ -189,6 +189,46 @@ export class SearchFields { return false; } } + +/* +AND + Funder: relfunder, relfundinglevel0_id, relfundinglevel1_id, relfundinglevel2_id + Project: relproject + Community: community +OR + Type: instancetypename, datasourcetypeuiname + Language: resultlanguagename, datasourceodlanguages + Compatibility Level: datasourcecompatibilityname + Country: country + Content: datasourceodcontenttypes + Content Provider: resulthostingdatasource + Collected From: collectedfrom +BULLETS + Access Mode: resultbestaccessright + Special Clause 39: projectecsc39 + Versioning: + +RANGE + Publication date: resultacceptanceyear + Project life: projectstartyear, projectendyear + +? WHAT ABOUT ?: + Subjects: + Supported Identifiers: +*/ + + getFieldOperator(fieldId:string):string{ + if(fieldId == "relfunder" || fieldId == "relfundinglevel0_id" || fieldId == "relfundinglevel1_id" || fieldId == "relfundinglevel2_id" + || fieldId == "relproject" || fieldId == "community") { + return "and"; + } else if(fieldId == "instancetypename" || fieldId == "datasourcetypeuiname" + || fieldId == "resultlanguagename" || fieldId == "datasourceodlanguages" + || fieldId == "datasourcecompatibilityname" || fieldId == "country" || fieldId == "datasourceodcontenttypes" + || fieldId == "resulthostingdatasource" || fieldId == "collectedfrom") { + return "or"; + } + return "or"; + } } export class FieldDetails{ name:string;