Refix parenthesis in search

This commit is contained in:
Konstantinos Triantafyllou 2022-08-31 12:55:09 +03:00
parent d45c573a56
commit 00868405c8
1 changed files with 2 additions and 4 deletions

View File

@ -909,7 +909,6 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
//TODO deposit case //TODO deposit case
// console.log(this.usedBy) // console.log(this.usedBy)
// console.log(this.keywordFields) // console.log(this.keywordFields)
if (this.usedBy == "deposit") { if (this.usedBy == "deposit") {
if (this.keywordFields.length > 0) { if (this.keywordFields.length > 0) {
@ -939,7 +938,6 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
params += NewSearchPageComponent.createQuotedKeywordQuery(this.selectedFields[i].value, this.selectedFields[i].id, this.selectedFields[i].operatorId, countParams, false); params += NewSearchPageComponent.createQuotedKeywordQuery(this.selectedFields[i].value, this.selectedFields[i].id, this.selectedFields[i].operatorId, countParams, false);
} else { } else {
params += (countParams == 0 ? "" : " " + this.selectedFields[i].operatorId + " ") + this.selectedFields[i].id + this.fieldIdsMap[this.selectedFields[i].id].equalityOperator + '"' + encodeURIComponent(this.selectedFields[i].value) + '"' + " "; params += (countParams == 0 ? "" : " " + this.selectedFields[i].operatorId + " ") + this.selectedFields[i].id + this.fieldIdsMap[this.selectedFields[i].id].equalityOperator + '"' + encodeURIComponent(this.selectedFields[i].value) + '"' + " ";
} }
} }
countParams++; countParams++;
@ -991,7 +989,7 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
} else { } else {
//if it is PIDs but no doisquery produced, forced to use quotes as the query will fail due to special characters //if it is PIDs but no doisquery produced, forced to use quotes as the query will fail due to special characters
params += this.createQuotedKeywordQuery(value, id, operatorId, countParams, true, params += this.createQuotedKeywordQuery(value, id, operatorId, countParams, true,
(DOIs.length > 0 && doisParams.length == 0), includes) + ")"; (DOIs.length > 0 && doisParams.length == 0), includes);
} }
return params; return params;
@ -1014,7 +1012,7 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
if (forceQuotted) { if (forceQuotted) {
/** Remove double quotes **/ /** Remove double quotes **/
fieldValue = fieldValue.replace(/["]+/g, ''); fieldValue = fieldValue.replace(/["]+/g, '');
return params + this.getQuotedQueryPart(fieldId, '"' + fieldValue + '"', isSearchAll); return params + this.getQuotedQueryPart(fieldId, '"' + fieldValue + '"', isSearchAll) + ")";
} }
if (quotedParts && quotedParts.length == 1 && quotedParts[0] == fieldValue) { if (quotedParts && quotedParts.length == 1 && quotedParts[0] == fieldValue) {
params += this.getQuotedQueryPart(fieldId, fieldValue, isSearchAll); params += this.getQuotedQueryPart(fieldId, fieldValue, isSearchAll);