Remove double quotes in case of forced double quotes. Fix parenthesis in quotes queries
This commit is contained in:
parent
ea95219728
commit
37becd5949
|
@ -990,7 +990,7 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
|
|||
}
|
||||
}
|
||||
if (doisParams.length > 0) {
|
||||
params += "(" + this.createQuotedKeywordQuery(value, id, operatorId, countParams, true, true) + " or " + doisParams + ")";
|
||||
params += this.createQuotedKeywordQuery(value, id, operatorId, countParams, true, true) + " or " + doisParams + ")";
|
||||
} else {
|
||||
//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,
|
||||
|
@ -1003,7 +1003,7 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
|
|||
|
||||
}
|
||||
|
||||
private static createQuotedKeywordQuery(fieldValue, fieldId, fieldOperator, countParams: number, isSearchAll: boolean, forceQuotted: boolean = false) {
|
||||
private static createQuotedKeywordQuery(fieldValue: string, fieldId, fieldOperator, countParams: number, isSearchAll: boolean, forceQuotted: boolean = false) {
|
||||
let params = "";
|
||||
let countQuote = (fieldValue.match(/'/g) || []).length;
|
||||
let countDoubleQuote = (fieldValue.match(/"/g) || []).length;
|
||||
|
@ -1014,7 +1014,9 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
|
|||
params += (countParams == 0 ? "" : fieldOperator);
|
||||
params += " (";
|
||||
if (forceQuotted) {
|
||||
return (countParams == 0 ? "" : " " + fieldOperator + " ") + this.getQuotedQueryPart(fieldId, '"' + fieldValue + '"', isSearchAll);
|
||||
/** Remove double quotes **/
|
||||
fieldValue = fieldValue.replace(/["]+/g, '');
|
||||
return (countParams == 0 ? "" : " " + fieldOperator + " (") + this.getQuotedQueryPart(fieldId, '"' + fieldValue + '"', isSearchAll);
|
||||
}
|
||||
if (quotedParts && quotedParts.length == 1 && quotedParts[0] == fieldValue) {
|
||||
params += this.getQuotedQueryPart(fieldId, fieldValue, isSearchAll);
|
||||
|
@ -1068,7 +1070,7 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
|
|||
i++;
|
||||
}
|
||||
}
|
||||
return query
|
||||
return query;
|
||||
}
|
||||
|
||||
private static checkForReservedWords(keyword: string) {
|
||||
|
|
|
@ -4,7 +4,6 @@ import { Observable } from 'rxjs';
|
|||
import { timeout } from 'rxjs/operators';
|
||||
import {isPlatformServer} from "@angular/common";
|
||||
import {properties} from "../../environments/environment";
|
||||
import {isArray} from "util";
|
||||
|
||||
export const DEFAULT_TIMEOUT = new InjectionToken<number>('defaultTimeout');
|
||||
|
||||
|
|
Loading…
Reference in New Issue