mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +01:00
Update match_query.js
fix quoting fix not operand loss
This commit is contained in:
parent
7bc51f9b46
commit
4d96843286
1 changed files with 6 additions and 6 deletions
|
@ -6,7 +6,7 @@
|
||||||
const tokenList = [
|
const tokenList = [
|
||||||
['fuzz', /^~(?:\d+(\.\d+)?|\.\d+)/],
|
['fuzz', /^~(?:\d+(\.\d+)?|\.\d+)/],
|
||||||
['boost', /^\^[\-\+]?\d+(\.\d+)?/],
|
['boost', /^\^[\-\+]?\d+(\.\d+)?/],
|
||||||
['quoted_lit', /^\s*"(?:(?:[^"]|\\")+)"/],
|
['quoted_lit', /^\s*"((?:(?:[^"]|\\")+))"/],
|
||||||
['lparen', /^\s*\(\s*/],
|
['lparen', /^\s*\(\s*/],
|
||||||
['rparen', /^\s*\)\s*/],
|
['rparen', /^\s*\)\s*/],
|
||||||
['and_op', /^\s*(?:\&\&|AND)\s+/],
|
['and_op', /^\s*(?:\&\&|AND)\s+/],
|
||||||
|
@ -487,7 +487,7 @@ function generateLexArray(searchStr, options) {
|
||||||
fuzz = null,
|
fuzz = null,
|
||||||
lparenCtr = 0,
|
lparenCtr = 0,
|
||||||
negate = false,
|
negate = false,
|
||||||
groupNegate = false,
|
groupNegate = [],
|
||||||
tokenStack = [],
|
tokenStack = [],
|
||||||
boostFuzzStr = '';
|
boostFuzzStr = '';
|
||||||
|
|
||||||
|
@ -496,6 +496,7 @@ function generateLexArray(searchStr, options) {
|
||||||
let tokenName = tokenArr[0],
|
let tokenName = tokenArr[0],
|
||||||
tokenRE = tokenArr[1],
|
tokenRE = tokenArr[1],
|
||||||
match = tokenRE.exec(searchStr),
|
match = tokenRE.exec(searchStr),
|
||||||
|
initialMatch = match,
|
||||||
balanced, op;
|
balanced, op;
|
||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
|
@ -553,7 +554,7 @@ function generateLexArray(searchStr, options) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
opQueue.unshift('lparen');
|
opQueue.unshift('lparen');
|
||||||
groupNegate = negate;
|
groupNegate.push(negate);
|
||||||
negate = false;
|
negate = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -573,9 +574,8 @@ function generateLexArray(searchStr, options) {
|
||||||
tokenStack.push(op);
|
tokenStack.push(op);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (groupNegate) {
|
if (groupNegate.length > 0 && groupNegate.pop()) {
|
||||||
tokenStack.push('not_op');
|
tokenStack.push('not_op');
|
||||||
groupNegate = false;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'fuzz':
|
case 'fuzz':
|
||||||
|
@ -604,7 +604,7 @@ function generateLexArray(searchStr, options) {
|
||||||
searchTerm.append(match);
|
searchTerm.append(match);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
searchTerm = new SearchTerm(match, options);
|
searchTerm = new SearchTerm(initialMatch[1], options);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'word':
|
case 'word':
|
||||||
|
|
Loading…
Reference in a new issue