[Library | Trunk]

Search page: 
in keyword search split keywords and make separate queries ("keyword1") and ("keyword2")
use quotes to allow keywords with characters like .@



git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@59165 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2020-07-24 12:27:40 +00:00
parent 8b9ceb091b
commit 18c82d1172
1 changed files with 11 additions and 5 deletions

View File

@ -846,7 +846,7 @@ export class NewSearchPageComponent {
params+= (countParams == 0 ? "" : fieldOperator);
params+= " (";
if(forceQuotted){
return this.getQuotedQueryPart(fieldId, '"'+ fieldValue+'"',isSearchAll);
return (countParams == 0 ? "" : " "+fieldOperator+" ") + this.getQuotedQueryPart(fieldId, '"'+ fieldValue+'"',isSearchAll);
}
if(quotedParts && quotedParts.length == 1 && quotedParts[0] == fieldValue ){
params+=this.getQuotedQueryPart(fieldId, fieldValue,isSearchAll);
@ -889,11 +889,17 @@ export class NewSearchPageComponent {
return (isSearchAll?"__all":fieldId)+" exact "+StringUtils.URIEncode(value);
}
private static getNoQuotedQueryPart(fieldId:string, value:string, isSearchAll:boolean){
if(isSearchAll){
return StringUtils.URIEncode(value);
}else{
return fieldId+"="+ StringUtils.URIEncode(value);
//split the keywords of the vlaue and query seperately for each keyword using quotes to allow characters like .@
let valueKeywords= value.split(" ");
let query = "";
let i=0;
for(let keyword of valueKeywords ){
if(keyword.length > 0){
query+= (i!=0?" and ":"")+(isSearchAll?"(":fieldId+"=")+"\""+StringUtils.URIEncode(keyword) +"\""+ (isSearchAll?")":"");
i++;
}
}
return query
}
/**