Revision 59635
Added by Argiro Kokogiannaki over 3 years ago
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/newSearchPage.component.ts | ||
---|---|---|
971 | 971 |
let i=0; |
972 | 972 |
for(let keyword of valueKeywords ){ |
973 | 973 |
if(keyword.length > 0){ |
974 |
query+= (i!=0?" and ":"")+(isSearchAll?"(":fieldId+"=")+"\""+StringUtils.URIEncode(keyword) +"\""+ (isSearchAll?")":"");
|
|
974 |
query+= (i!=0?" and ":"")+(isSearchAll?"(":fieldId+"=")+"\""+StringUtils.URIEncode(this.checkForReservedWords(keyword)) +"\""+ (isSearchAll?")":"");
|
|
975 | 975 |
i++; |
976 | 976 |
} |
977 | 977 |
} |
978 | 978 |
return query |
979 | 979 |
} |
980 |
|
|
980 |
private static checkForReservedWords(keyword:string){ |
|
981 |
let reservedWords = ["AND", "OR", "NOT"]; |
|
982 |
if(reservedWords.indexOf(keyword)!=-1){ |
|
983 |
return keyword.toLowerCase(); |
|
984 |
} |
|
985 |
return keyword; |
|
986 |
} |
|
981 | 987 |
/** |
982 | 988 |
* Create Search API query based on the filters of refine fields |
983 | 989 |
* @param URLparams |
Also available in: Unified diff
[Library|Trunk]
Keyword Search: check for reserved words to avoid error 500 in search service