[Library|Trunk]

Keyword Search: check for reserved words to avoid error 500 in search service


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@59635 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2020-10-20 10:21:37 +00:00
parent 2901fe8e48
commit 9818056509
1 changed files with 8 additions and 2 deletions

View File

@ -971,13 +971,19 @@ export class NewSearchPageComponent {
let i=0;
for(let keyword of valueKeywords ){
if(keyword.length > 0){
query+= (i!=0?" and ":"")+(isSearchAll?"(":fieldId+"=")+"\""+StringUtils.URIEncode(keyword) +"\""+ (isSearchAll?")":"");
query+= (i!=0?" and ":"")+(isSearchAll?"(":fieldId+"=")+"\""+StringUtils.URIEncode(this.checkForReservedWords(keyword)) +"\""+ (isSearchAll?")":"");
i++;
}
}
return query
}
private static checkForReservedWords(keyword:string){
let reservedWords = ["AND", "OR", "NOT"];
if(reservedWords.indexOf(keyword)!=-1){
return keyword.toLowerCase();
}
return keyword;
}
/**
* Create Search API query based on the filters of refine fields
* @param URLparams