feat: added support for hasToken function in QB (#9058)

* feat: updated grammer to add hasToken function

* feat: added function constant
This commit is contained in:
Abhi kumar 2025-09-11 12:55:13 +05:30 committed by GitHub
parent 9d999feabb
commit c477ec65da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 183 additions and 160 deletions

View File

@ -23,6 +23,7 @@ import cx from 'classnames';
import { import {
negationQueryOperatorSuggestions, negationQueryOperatorSuggestions,
OPERATORS, OPERATORS,
QUERY_BUILDER_FUNCTIONS,
QUERY_BUILDER_KEY_TYPES, QUERY_BUILDER_KEY_TYPES,
QUERY_BUILDER_OPERATORS_BY_KEY_TYPE, QUERY_BUILDER_OPERATORS_BY_KEY_TYPE,
queryOperatorSuggestions, queryOperatorSuggestions,
@ -1076,11 +1077,11 @@ function QuerySearch({
} }
if (queryContext.isInFunction) { if (queryContext.isInFunction) {
options = [ options = Object.values(QUERY_BUILDER_FUNCTIONS).map((option) => ({
{ label: 'HAS', type: 'function' }, label: option,
{ label: 'HASANY', type: 'function' }, apply: `${option}()`,
{ label: 'HASALL', type: 'function' }, type: 'function',
]; }));
// Add space after selection for functions // Add space after selection for functions
const optionsWithSpace = addSpaceToOptions(options); const optionsWithSpace = addSpaceToOptions(options);

View File

@ -42,6 +42,7 @@ export const QUERY_BUILDER_FUNCTIONS = {
HAS: 'has', HAS: 'has',
HASANY: 'hasAny', HASANY: 'hasAny',
HASALL: 'hasAll', HASALL: 'hasAll',
HASTOKEN: 'hasToken',
}; };
export function negateOperator(operatorOrFunction: string): string { export function negateOperator(operatorOrFunction: string): string {

File diff suppressed because one or more lines are too long

View File

@ -20,15 +20,16 @@ IN=19
NOT=20 NOT=20
AND=21 AND=21
OR=22 OR=22
HAS=23 HASTOKEN=23
HASANY=24 HAS=24
HASALL=25 HASANY=25
BOOL=26 HASALL=26
NUMBER=27 BOOL=27
QUOTED_TEXT=28 NUMBER=28
KEY=29 QUOTED_TEXT=29
WS=30 KEY=30
FREETEXT=31 WS=31
FREETEXT=32
'('=1 '('=1
')'=2 ')'=2
'['=3 '['=3

File diff suppressed because one or more lines are too long

View File

@ -20,15 +20,16 @@ IN=19
NOT=20 NOT=20
AND=21 AND=21
OR=22 OR=22
HAS=23 HASTOKEN=23
HASANY=24 HAS=24
HASALL=25 HASANY=25
BOOL=26 HASALL=26
NUMBER=27 BOOL=27
QUOTED_TEXT=28 NUMBER=28
KEY=29 QUOTED_TEXT=29
WS=30 KEY=30
FREETEXT=31 WS=31
FREETEXT=32
'('=1 '('=1
')'=2 ')'=2
'['=3 '['=3

View File

@ -1,4 +1,4 @@
// Generated from FilterQuery.g4 by ANTLR 4.13.1 // Generated from ../../../../grammar/FilterQuery.g4 by ANTLR 4.13.1
// noinspection ES6UnusedImports,JSUnusedGlobalSymbols,JSUnusedLocalSymbols // noinspection ES6UnusedImports,JSUnusedGlobalSymbols,JSUnusedLocalSymbols
import { import {
ATN, ATN,
@ -34,15 +34,16 @@ export default class FilterQueryLexer extends Lexer {
public static readonly NOT = 20; public static readonly NOT = 20;
public static readonly AND = 21; public static readonly AND = 21;
public static readonly OR = 22; public static readonly OR = 22;
public static readonly HAS = 23; public static readonly HASTOKEN = 23;
public static readonly HASANY = 24; public static readonly HAS = 24;
public static readonly HASALL = 25; public static readonly HASANY = 25;
public static readonly BOOL = 26; public static readonly HASALL = 26;
public static readonly NUMBER = 27; public static readonly BOOL = 27;
public static readonly QUOTED_TEXT = 28; public static readonly NUMBER = 28;
public static readonly KEY = 29; public static readonly QUOTED_TEXT = 29;
public static readonly WS = 30; public static readonly KEY = 30;
public static readonly FREETEXT = 31; public static readonly WS = 31;
public static readonly FREETEXT = 32;
public static readonly EOF = Token.EOF; public static readonly EOF = Token.EOF;
public static readonly channelNames: string[] = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ]; public static readonly channelNames: string[] = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
@ -65,6 +66,7 @@ export default class FilterQueryLexer extends Lexer {
"CONTAINS", "CONTAINS",
"IN", "NOT", "IN", "NOT",
"AND", "OR", "AND", "OR",
"HASTOKEN",
"HAS", "HASANY", "HAS", "HASANY",
"HASALL", "BOOL", "HASALL", "BOOL",
"NUMBER", "QUOTED_TEXT", "NUMBER", "QUOTED_TEXT",
@ -75,8 +77,8 @@ export default class FilterQueryLexer extends Lexer {
public static readonly ruleNames: string[] = [ public static readonly ruleNames: string[] = [
"LPAREN", "RPAREN", "LBRACK", "RBRACK", "COMMA", "EQUALS", "NOT_EQUALS", "LPAREN", "RPAREN", "LBRACK", "RBRACK", "COMMA", "EQUALS", "NOT_EQUALS",
"NEQ", "LT", "LE", "GT", "GE", "LIKE", "ILIKE", "BETWEEN", "EXISTS", "REGEXP", "NEQ", "LT", "LE", "GT", "GE", "LIKE", "ILIKE", "BETWEEN", "EXISTS", "REGEXP",
"CONTAINS", "IN", "NOT", "AND", "OR", "HAS", "HASANY", "HASALL", "BOOL", "CONTAINS", "IN", "NOT", "AND", "OR", "HASTOKEN", "HAS", "HASANY", "HASALL",
"SIGN", "NUMBER", "QUOTED_TEXT", "SEGMENT", "EMPTY_BRACKS", "OLD_JSON_BRACKS", "BOOL", "SIGN", "NUMBER", "QUOTED_TEXT", "SEGMENT", "EMPTY_BRACKS", "OLD_JSON_BRACKS",
"KEY", "WS", "DIGIT", "FREETEXT", "KEY", "WS", "DIGIT", "FREETEXT",
]; ];
@ -98,113 +100,116 @@ export default class FilterQueryLexer extends Lexer {
public get modeNames(): string[] { return FilterQueryLexer.modeNames; } public get modeNames(): string[] { return FilterQueryLexer.modeNames; }
public static readonly _serializedATN: number[] = [4,0,31,303,6,-1,2,0, public static readonly _serializedATN: number[] = [4,0,32,314,6,-1,2,0,
7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9, 7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,
7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7, 7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,
16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23, 16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,
2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2, 2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,
31,7,31,2,32,7,32,2,33,7,33,2,34,7,34,2,35,7,35,1,0,1,0,1,1,1,1,1,2,1,2, 31,7,31,2,32,7,32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,1,0,1,0,1,1,1,
1,3,1,3,1,4,1,4,1,5,1,5,1,5,3,5,87,8,5,1,6,1,6,1,6,1,7,1,7,1,7,1,8,1,8, 1,1,2,1,2,1,3,1,3,1,4,1,4,1,5,1,5,1,5,3,5,89,8,5,1,6,1,6,1,6,1,7,1,7,1,
1,9,1,9,1,9,1,10,1,10,1,11,1,11,1,11,1,12,1,12,1,12,1,12,1,12,1,13,1,13, 7,1,8,1,8,1,9,1,9,1,9,1,10,1,10,1,11,1,11,1,11,1,12,1,12,1,12,1,12,1,12,
1,13,1,13,1,13,1,13,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,15,1,15,1, 1,13,1,13,1,13,1,13,1,13,1,13,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,
15,1,15,1,15,1,15,3,15,130,8,15,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,17, 15,1,15,1,15,1,15,1,15,1,15,3,15,132,8,15,1,16,1,16,1,16,1,16,1,16,1,16,
1,17,1,17,1,17,1,17,1,17,1,17,1,17,3,17,147,8,17,1,18,1,18,1,18,1,19,1, 1,16,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,3,17,149,8,17,1,18,1,18,1,
19,1,19,1,19,1,20,1,20,1,20,1,20,1,21,1,21,1,21,1,22,1,22,1,22,1,22,1,23, 18,1,19,1,19,1,19,1,19,1,20,1,20,1,20,1,20,1,21,1,21,1,21,1,22,1,22,1,22,
1,23,1,23,1,23,1,23,1,23,1,23,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,25,1, 1,22,1,22,1,22,1,22,1,22,1,22,1,23,1,23,1,23,1,23,1,24,1,24,1,24,1,24,1,
25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,3,25,190,8,25,1,26,1,26,1,27,3,27, 24,1,24,1,24,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,26,1,26,1,26,1,26,1,26,
195,8,27,1,27,4,27,198,8,27,11,27,12,27,199,1,27,1,27,5,27,204,8,27,10, 1,26,1,26,1,26,1,26,3,26,201,8,26,1,27,1,27,1,28,3,28,206,8,28,1,28,4,28,
27,12,27,207,9,27,3,27,209,8,27,1,27,1,27,3,27,213,8,27,1,27,4,27,216,8, 209,8,28,11,28,12,28,210,1,28,1,28,5,28,215,8,28,10,28,12,28,218,9,28,3,
27,11,27,12,27,217,3,27,220,8,27,1,27,3,27,223,8,27,1,27,1,27,4,27,227, 28,220,8,28,1,28,1,28,3,28,224,8,28,1,28,4,28,227,8,28,11,28,12,28,228,
8,27,11,27,12,27,228,1,27,1,27,3,27,233,8,27,1,27,4,27,236,8,27,11,27,12, 3,28,231,8,28,1,28,3,28,234,8,28,1,28,1,28,4,28,238,8,28,11,28,12,28,239,
27,237,3,27,240,8,27,3,27,242,8,27,1,28,1,28,1,28,1,28,5,28,248,8,28,10, 1,28,1,28,3,28,244,8,28,1,28,4,28,247,8,28,11,28,12,28,248,3,28,251,8,28,
28,12,28,251,9,28,1,28,1,28,1,28,1,28,1,28,5,28,258,8,28,10,28,12,28,261, 3,28,253,8,28,1,29,1,29,1,29,1,29,5,29,259,8,29,10,29,12,29,262,9,29,1,
9,28,1,28,3,28,264,8,28,1,29,1,29,5,29,268,8,29,10,29,12,29,271,9,29,1, 29,1,29,1,29,1,29,1,29,5,29,269,8,29,10,29,12,29,272,9,29,1,29,3,29,275,
30,1,30,1,30,1,31,1,31,1,31,1,31,1,32,1,32,1,32,1,32,1,32,5,32,285,8,32, 8,29,1,30,1,30,5,30,279,8,30,10,30,12,30,282,9,30,1,31,1,31,1,31,1,32,1,
10,32,12,32,288,9,32,1,33,4,33,291,8,33,11,33,12,33,292,1,33,1,33,1,34, 32,1,32,1,32,1,33,1,33,1,33,1,33,1,33,5,33,296,8,33,10,33,12,33,299,9,33,
1,34,1,35,4,35,300,8,35,11,35,12,35,301,0,0,36,1,1,3,2,5,3,7,4,9,5,11,6, 1,34,4,34,302,8,34,11,34,12,34,303,1,34,1,34,1,35,1,35,1,36,4,36,311,8,
13,7,15,8,17,9,19,10,21,11,23,12,25,13,27,14,29,15,31,16,33,17,35,18,37, 36,11,36,12,36,312,0,0,37,1,1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,10,
19,39,20,41,21,43,22,45,23,47,24,49,25,51,26,53,0,55,27,57,28,59,0,61,0, 21,11,23,12,25,13,27,14,29,15,31,16,33,17,35,18,37,19,39,20,41,21,43,22,
63,0,65,29,67,30,69,0,71,31,1,0,29,2,0,76,76,108,108,2,0,73,73,105,105, 45,23,47,24,49,25,51,26,53,27,55,0,57,28,59,29,61,0,63,0,65,0,67,30,69,
2,0,75,75,107,107,2,0,69,69,101,101,2,0,66,66,98,98,2,0,84,84,116,116,2, 31,71,0,73,32,1,0,29,2,0,76,76,108,108,2,0,73,73,105,105,2,0,75,75,107,
0,87,87,119,119,2,0,78,78,110,110,2,0,88,88,120,120,2,0,83,83,115,115,2, 107,2,0,69,69,101,101,2,0,66,66,98,98,2,0,84,84,116,116,2,0,87,87,119,119,
0,82,82,114,114,2,0,71,71,103,103,2,0,80,80,112,112,2,0,67,67,99,99,2,0, 2,0,78,78,110,110,2,0,88,88,120,120,2,0,83,83,115,115,2,0,82,82,114,114,
79,79,111,111,2,0,65,65,97,97,2,0,68,68,100,100,2,0,72,72,104,104,2,0,89, 2,0,71,71,103,103,2,0,80,80,112,112,2,0,67,67,99,99,2,0,79,79,111,111,2,
89,121,121,2,0,85,85,117,117,2,0,70,70,102,102,2,0,43,43,45,45,2,0,34,34, 0,65,65,97,97,2,0,68,68,100,100,2,0,72,72,104,104,2,0,89,89,121,121,2,0,
92,92,2,0,39,39,92,92,4,0,36,36,65,90,95,95,97,122,6,0,36,36,45,45,47,58, 85,85,117,117,2,0,70,70,102,102,2,0,43,43,45,45,2,0,34,34,92,92,2,0,39,
65,90,95,95,97,122,3,0,9,10,13,13,32,32,1,0,48,57,8,0,9,10,13,13,32,34, 39,92,92,4,0,36,36,65,90,95,95,97,122,6,0,36,36,45,45,47,58,65,90,95,95,
39,41,44,44,60,62,91,91,93,93,325,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0, 97,122,3,0,9,10,13,13,32,32,1,0,48,57,8,0,9,10,13,13,32,34,39,41,44,44,
7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0, 60,62,91,91,93,93,336,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,
0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25,1,0,0,0,0,27,1,0,0,0,0,29, 9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,
1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,0,0,37,1,0,0,0,0,39,1,0,0, 0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25,1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,
0,0,41,1,0,0,0,0,43,1,0,0,0,0,45,1,0,0,0,0,47,1,0,0,0,0,49,1,0,0,0,0,51, 31,1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,
1,0,0,0,0,55,1,0,0,0,0,57,1,0,0,0,0,65,1,0,0,0,0,67,1,0,0,0,0,71,1,0,0, 0,0,0,43,1,0,0,0,0,45,1,0,0,0,0,47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,
0,1,73,1,0,0,0,3,75,1,0,0,0,5,77,1,0,0,0,7,79,1,0,0,0,9,81,1,0,0,0,11,86, 53,1,0,0,0,0,57,1,0,0,0,0,59,1,0,0,0,0,67,1,0,0,0,0,69,1,0,0,0,0,73,1,0,
1,0,0,0,13,88,1,0,0,0,15,91,1,0,0,0,17,94,1,0,0,0,19,96,1,0,0,0,21,99,1, 0,0,1,75,1,0,0,0,3,77,1,0,0,0,5,79,1,0,0,0,7,81,1,0,0,0,9,83,1,0,0,0,11,
0,0,0,23,101,1,0,0,0,25,104,1,0,0,0,27,109,1,0,0,0,29,115,1,0,0,0,31,123, 88,1,0,0,0,13,90,1,0,0,0,15,93,1,0,0,0,17,96,1,0,0,0,19,98,1,0,0,0,21,101,
1,0,0,0,33,131,1,0,0,0,35,138,1,0,0,0,37,148,1,0,0,0,39,151,1,0,0,0,41, 1,0,0,0,23,103,1,0,0,0,25,106,1,0,0,0,27,111,1,0,0,0,29,117,1,0,0,0,31,
155,1,0,0,0,43,159,1,0,0,0,45,162,1,0,0,0,47,166,1,0,0,0,49,173,1,0,0,0, 125,1,0,0,0,33,133,1,0,0,0,35,140,1,0,0,0,37,150,1,0,0,0,39,153,1,0,0,0,
51,189,1,0,0,0,53,191,1,0,0,0,55,241,1,0,0,0,57,263,1,0,0,0,59,265,1,0, 41,157,1,0,0,0,43,161,1,0,0,0,45,164,1,0,0,0,47,173,1,0,0,0,49,177,1,0,
0,0,61,272,1,0,0,0,63,275,1,0,0,0,65,279,1,0,0,0,67,290,1,0,0,0,69,296, 0,0,51,184,1,0,0,0,53,200,1,0,0,0,55,202,1,0,0,0,57,252,1,0,0,0,59,274,
1,0,0,0,71,299,1,0,0,0,73,74,5,40,0,0,74,2,1,0,0,0,75,76,5,41,0,0,76,4, 1,0,0,0,61,276,1,0,0,0,63,283,1,0,0,0,65,286,1,0,0,0,67,290,1,0,0,0,69,
1,0,0,0,77,78,5,91,0,0,78,6,1,0,0,0,79,80,5,93,0,0,80,8,1,0,0,0,81,82,5, 301,1,0,0,0,71,307,1,0,0,0,73,310,1,0,0,0,75,76,5,40,0,0,76,2,1,0,0,0,77,
44,0,0,82,10,1,0,0,0,83,87,5,61,0,0,84,85,5,61,0,0,85,87,5,61,0,0,86,83, 78,5,41,0,0,78,4,1,0,0,0,79,80,5,91,0,0,80,6,1,0,0,0,81,82,5,93,0,0,82,
1,0,0,0,86,84,1,0,0,0,87,12,1,0,0,0,88,89,5,33,0,0,89,90,5,61,0,0,90,14, 8,1,0,0,0,83,84,5,44,0,0,84,10,1,0,0,0,85,89,5,61,0,0,86,87,5,61,0,0,87,
1,0,0,0,91,92,5,60,0,0,92,93,5,62,0,0,93,16,1,0,0,0,94,95,5,60,0,0,95,18, 89,5,61,0,0,88,85,1,0,0,0,88,86,1,0,0,0,89,12,1,0,0,0,90,91,5,33,0,0,91,
1,0,0,0,96,97,5,60,0,0,97,98,5,61,0,0,98,20,1,0,0,0,99,100,5,62,0,0,100, 92,5,61,0,0,92,14,1,0,0,0,93,94,5,60,0,0,94,95,5,62,0,0,95,16,1,0,0,0,96,
22,1,0,0,0,101,102,5,62,0,0,102,103,5,61,0,0,103,24,1,0,0,0,104,105,7,0, 97,5,60,0,0,97,18,1,0,0,0,98,99,5,60,0,0,99,100,5,61,0,0,100,20,1,0,0,0,
0,0,105,106,7,1,0,0,106,107,7,2,0,0,107,108,7,3,0,0,108,26,1,0,0,0,109, 101,102,5,62,0,0,102,22,1,0,0,0,103,104,5,62,0,0,104,105,5,61,0,0,105,24,
110,7,1,0,0,110,111,7,0,0,0,111,112,7,1,0,0,112,113,7,2,0,0,113,114,7,3, 1,0,0,0,106,107,7,0,0,0,107,108,7,1,0,0,108,109,7,2,0,0,109,110,7,3,0,0,
0,0,114,28,1,0,0,0,115,116,7,4,0,0,116,117,7,3,0,0,117,118,7,5,0,0,118, 110,26,1,0,0,0,111,112,7,1,0,0,112,113,7,0,0,0,113,114,7,1,0,0,114,115,
119,7,6,0,0,119,120,7,3,0,0,120,121,7,3,0,0,121,122,7,7,0,0,122,30,1,0, 7,2,0,0,115,116,7,3,0,0,116,28,1,0,0,0,117,118,7,4,0,0,118,119,7,3,0,0,
0,0,123,124,7,3,0,0,124,125,7,8,0,0,125,126,7,1,0,0,126,127,7,9,0,0,127, 119,120,7,5,0,0,120,121,7,6,0,0,121,122,7,3,0,0,122,123,7,3,0,0,123,124,
129,7,5,0,0,128,130,7,9,0,0,129,128,1,0,0,0,129,130,1,0,0,0,130,32,1,0, 7,7,0,0,124,30,1,0,0,0,125,126,7,3,0,0,126,127,7,8,0,0,127,128,7,1,0,0,
0,0,131,132,7,10,0,0,132,133,7,3,0,0,133,134,7,11,0,0,134,135,7,3,0,0,135, 128,129,7,9,0,0,129,131,7,5,0,0,130,132,7,9,0,0,131,130,1,0,0,0,131,132,
136,7,8,0,0,136,137,7,12,0,0,137,34,1,0,0,0,138,139,7,13,0,0,139,140,7, 1,0,0,0,132,32,1,0,0,0,133,134,7,10,0,0,134,135,7,3,0,0,135,136,7,11,0,
14,0,0,140,141,7,7,0,0,141,142,7,5,0,0,142,143,7,15,0,0,143,144,7,1,0,0, 0,136,137,7,3,0,0,137,138,7,8,0,0,138,139,7,12,0,0,139,34,1,0,0,0,140,141,
144,146,7,7,0,0,145,147,7,9,0,0,146,145,1,0,0,0,146,147,1,0,0,0,147,36, 7,13,0,0,141,142,7,14,0,0,142,143,7,7,0,0,143,144,7,5,0,0,144,145,7,15,
1,0,0,0,148,149,7,1,0,0,149,150,7,7,0,0,150,38,1,0,0,0,151,152,7,7,0,0, 0,0,145,146,7,1,0,0,146,148,7,7,0,0,147,149,7,9,0,0,148,147,1,0,0,0,148,
152,153,7,14,0,0,153,154,7,5,0,0,154,40,1,0,0,0,155,156,7,15,0,0,156,157, 149,1,0,0,0,149,36,1,0,0,0,150,151,7,1,0,0,151,152,7,7,0,0,152,38,1,0,0,
7,7,0,0,157,158,7,16,0,0,158,42,1,0,0,0,159,160,7,14,0,0,160,161,7,10,0, 0,153,154,7,7,0,0,154,155,7,14,0,0,155,156,7,5,0,0,156,40,1,0,0,0,157,158,
0,161,44,1,0,0,0,162,163,7,17,0,0,163,164,7,15,0,0,164,165,7,9,0,0,165, 7,15,0,0,158,159,7,7,0,0,159,160,7,16,0,0,160,42,1,0,0,0,161,162,7,14,0,
46,1,0,0,0,166,167,7,17,0,0,167,168,7,15,0,0,168,169,7,9,0,0,169,170,7, 0,162,163,7,10,0,0,163,44,1,0,0,0,164,165,7,17,0,0,165,166,7,15,0,0,166,
15,0,0,170,171,7,7,0,0,171,172,7,18,0,0,172,48,1,0,0,0,173,174,7,17,0,0, 167,7,9,0,0,167,168,7,5,0,0,168,169,7,14,0,0,169,170,7,2,0,0,170,171,7,
174,175,7,15,0,0,175,176,7,9,0,0,176,177,7,15,0,0,177,178,7,0,0,0,178,179, 3,0,0,171,172,7,7,0,0,172,46,1,0,0,0,173,174,7,17,0,0,174,175,7,15,0,0,
7,0,0,0,179,50,1,0,0,0,180,181,7,5,0,0,181,182,7,10,0,0,182,183,7,19,0, 175,176,7,9,0,0,176,48,1,0,0,0,177,178,7,17,0,0,178,179,7,15,0,0,179,180,
0,183,190,7,3,0,0,184,185,7,20,0,0,185,186,7,15,0,0,186,187,7,0,0,0,187, 7,9,0,0,180,181,7,15,0,0,181,182,7,7,0,0,182,183,7,18,0,0,183,50,1,0,0,
188,7,9,0,0,188,190,7,3,0,0,189,180,1,0,0,0,189,184,1,0,0,0,190,52,1,0, 0,184,185,7,17,0,0,185,186,7,15,0,0,186,187,7,9,0,0,187,188,7,15,0,0,188,
0,0,191,192,7,21,0,0,192,54,1,0,0,0,193,195,3,53,26,0,194,193,1,0,0,0,194, 189,7,0,0,0,189,190,7,0,0,0,190,52,1,0,0,0,191,192,7,5,0,0,192,193,7,10,
195,1,0,0,0,195,197,1,0,0,0,196,198,3,69,34,0,197,196,1,0,0,0,198,199,1, 0,0,193,194,7,19,0,0,194,201,7,3,0,0,195,196,7,20,0,0,196,197,7,15,0,0,
0,0,0,199,197,1,0,0,0,199,200,1,0,0,0,200,208,1,0,0,0,201,205,5,46,0,0, 197,198,7,0,0,0,198,199,7,9,0,0,199,201,7,3,0,0,200,191,1,0,0,0,200,195,
202,204,3,69,34,0,203,202,1,0,0,0,204,207,1,0,0,0,205,203,1,0,0,0,205,206, 1,0,0,0,201,54,1,0,0,0,202,203,7,21,0,0,203,56,1,0,0,0,204,206,3,55,27,
1,0,0,0,206,209,1,0,0,0,207,205,1,0,0,0,208,201,1,0,0,0,208,209,1,0,0,0, 0,205,204,1,0,0,0,205,206,1,0,0,0,206,208,1,0,0,0,207,209,3,71,35,0,208,
209,219,1,0,0,0,210,212,7,3,0,0,211,213,3,53,26,0,212,211,1,0,0,0,212,213, 207,1,0,0,0,209,210,1,0,0,0,210,208,1,0,0,0,210,211,1,0,0,0,211,219,1,0,
1,0,0,0,213,215,1,0,0,0,214,216,3,69,34,0,215,214,1,0,0,0,216,217,1,0,0, 0,0,212,216,5,46,0,0,213,215,3,71,35,0,214,213,1,0,0,0,215,218,1,0,0,0,
0,217,215,1,0,0,0,217,218,1,0,0,0,218,220,1,0,0,0,219,210,1,0,0,0,219,220, 216,214,1,0,0,0,216,217,1,0,0,0,217,220,1,0,0,0,218,216,1,0,0,0,219,212,
1,0,0,0,220,242,1,0,0,0,221,223,3,53,26,0,222,221,1,0,0,0,222,223,1,0,0, 1,0,0,0,219,220,1,0,0,0,220,230,1,0,0,0,221,223,7,3,0,0,222,224,3,55,27,
0,223,224,1,0,0,0,224,226,5,46,0,0,225,227,3,69,34,0,226,225,1,0,0,0,227, 0,223,222,1,0,0,0,223,224,1,0,0,0,224,226,1,0,0,0,225,227,3,71,35,0,226,
228,1,0,0,0,228,226,1,0,0,0,228,229,1,0,0,0,229,239,1,0,0,0,230,232,7,3, 225,1,0,0,0,227,228,1,0,0,0,228,226,1,0,0,0,228,229,1,0,0,0,229,231,1,0,
0,0,231,233,3,53,26,0,232,231,1,0,0,0,232,233,1,0,0,0,233,235,1,0,0,0,234, 0,0,230,221,1,0,0,0,230,231,1,0,0,0,231,253,1,0,0,0,232,234,3,55,27,0,233,
236,3,69,34,0,235,234,1,0,0,0,236,237,1,0,0,0,237,235,1,0,0,0,237,238,1, 232,1,0,0,0,233,234,1,0,0,0,234,235,1,0,0,0,235,237,5,46,0,0,236,238,3,
0,0,0,238,240,1,0,0,0,239,230,1,0,0,0,239,240,1,0,0,0,240,242,1,0,0,0,241, 71,35,0,237,236,1,0,0,0,238,239,1,0,0,0,239,237,1,0,0,0,239,240,1,0,0,0,
194,1,0,0,0,241,222,1,0,0,0,242,56,1,0,0,0,243,249,5,34,0,0,244,248,8,22, 240,250,1,0,0,0,241,243,7,3,0,0,242,244,3,55,27,0,243,242,1,0,0,0,243,244,
0,0,245,246,5,92,0,0,246,248,9,0,0,0,247,244,1,0,0,0,247,245,1,0,0,0,248, 1,0,0,0,244,246,1,0,0,0,245,247,3,71,35,0,246,245,1,0,0,0,247,248,1,0,0,
251,1,0,0,0,249,247,1,0,0,0,249,250,1,0,0,0,250,252,1,0,0,0,251,249,1,0, 0,248,246,1,0,0,0,248,249,1,0,0,0,249,251,1,0,0,0,250,241,1,0,0,0,250,251,
0,0,252,264,5,34,0,0,253,259,5,39,0,0,254,258,8,23,0,0,255,256,5,92,0,0, 1,0,0,0,251,253,1,0,0,0,252,205,1,0,0,0,252,233,1,0,0,0,253,58,1,0,0,0,
256,258,9,0,0,0,257,254,1,0,0,0,257,255,1,0,0,0,258,261,1,0,0,0,259,257, 254,260,5,34,0,0,255,259,8,22,0,0,256,257,5,92,0,0,257,259,9,0,0,0,258,
1,0,0,0,259,260,1,0,0,0,260,262,1,0,0,0,261,259,1,0,0,0,262,264,5,39,0, 255,1,0,0,0,258,256,1,0,0,0,259,262,1,0,0,0,260,258,1,0,0,0,260,261,1,0,
0,263,243,1,0,0,0,263,253,1,0,0,0,264,58,1,0,0,0,265,269,7,24,0,0,266,268, 0,0,261,263,1,0,0,0,262,260,1,0,0,0,263,275,5,34,0,0,264,270,5,39,0,0,265,
7,25,0,0,267,266,1,0,0,0,268,271,1,0,0,0,269,267,1,0,0,0,269,270,1,0,0, 269,8,23,0,0,266,267,5,92,0,0,267,269,9,0,0,0,268,265,1,0,0,0,268,266,1,
0,270,60,1,0,0,0,271,269,1,0,0,0,272,273,5,91,0,0,273,274,5,93,0,0,274, 0,0,0,269,272,1,0,0,0,270,268,1,0,0,0,270,271,1,0,0,0,271,273,1,0,0,0,272,
62,1,0,0,0,275,276,5,91,0,0,276,277,5,42,0,0,277,278,5,93,0,0,278,64,1, 270,1,0,0,0,273,275,5,39,0,0,274,254,1,0,0,0,274,264,1,0,0,0,275,60,1,0,
0,0,0,279,286,3,59,29,0,280,281,5,46,0,0,281,285,3,59,29,0,282,285,3,61, 0,0,276,280,7,24,0,0,277,279,7,25,0,0,278,277,1,0,0,0,279,282,1,0,0,0,280,
30,0,283,285,3,63,31,0,284,280,1,0,0,0,284,282,1,0,0,0,284,283,1,0,0,0, 278,1,0,0,0,280,281,1,0,0,0,281,62,1,0,0,0,282,280,1,0,0,0,283,284,5,91,
285,288,1,0,0,0,286,284,1,0,0,0,286,287,1,0,0,0,287,66,1,0,0,0,288,286, 0,0,284,285,5,93,0,0,285,64,1,0,0,0,286,287,5,91,0,0,287,288,5,42,0,0,288,
1,0,0,0,289,291,7,26,0,0,290,289,1,0,0,0,291,292,1,0,0,0,292,290,1,0,0, 289,5,93,0,0,289,66,1,0,0,0,290,297,3,61,30,0,291,292,5,46,0,0,292,296,
0,292,293,1,0,0,0,293,294,1,0,0,0,294,295,6,33,0,0,295,68,1,0,0,0,296,297, 3,61,30,0,293,296,3,63,31,0,294,296,3,65,32,0,295,291,1,0,0,0,295,293,1,
7,27,0,0,297,70,1,0,0,0,298,300,8,28,0,0,299,298,1,0,0,0,300,301,1,0,0, 0,0,0,295,294,1,0,0,0,296,299,1,0,0,0,297,295,1,0,0,0,297,298,1,0,0,0,298,
0,301,299,1,0,0,0,301,302,1,0,0,0,302,72,1,0,0,0,28,0,86,129,146,189,194, 68,1,0,0,0,299,297,1,0,0,0,300,302,7,26,0,0,301,300,1,0,0,0,302,303,1,0,
199,205,208,212,217,219,222,228,232,237,239,241,247,249,257,259,263,269, 0,0,303,301,1,0,0,0,303,304,1,0,0,0,304,305,1,0,0,0,305,306,6,34,0,0,306,
284,286,292,301,1,6,0,0]; 70,1,0,0,0,307,308,7,27,0,0,308,72,1,0,0,0,309,311,8,28,0,0,310,309,1,0,
0,0,311,312,1,0,0,0,312,310,1,0,0,0,312,313,1,0,0,0,313,74,1,0,0,0,28,0,
88,131,148,200,205,210,216,219,223,228,230,233,239,243,248,250,252,258,
260,268,270,274,280,295,297,303,312,1,6,0,0];
private static __ATN: ATN; private static __ATN: ATN;
public static get _ATN(): ATN { public static get _ATN(): ATN {

View File

@ -1,4 +1,4 @@
// Generated from FilterQuery.g4 by ANTLR 4.13.1 // Generated from ../../../../grammar/FilterQuery.g4 by ANTLR 4.13.1
import {ParseTreeListener} from "antlr4"; import {ParseTreeListener} from "antlr4";
@ -198,3 +198,4 @@ export default class FilterQueryListener extends ParseTreeListener {
*/ */
exitKey?: (ctx: KeyContext) => void; exitKey?: (ctx: KeyContext) => void;
} }

View File

@ -1,4 +1,4 @@
// Generated from FilterQuery.g4 by ANTLR 4.13.1 // Generated from ../../../../grammar/FilterQuery.g4 by ANTLR 4.13.1
// noinspection ES6UnusedImports,JSUnusedGlobalSymbols,JSUnusedLocalSymbols // noinspection ES6UnusedImports,JSUnusedGlobalSymbols,JSUnusedLocalSymbols
import { import {
@ -41,15 +41,16 @@ export default class FilterQueryParser extends Parser {
public static readonly NOT = 20; public static readonly NOT = 20;
public static readonly AND = 21; public static readonly AND = 21;
public static readonly OR = 22; public static readonly OR = 22;
public static readonly HAS = 23; public static readonly HASTOKEN = 23;
public static readonly HASANY = 24; public static readonly HAS = 24;
public static readonly HASALL = 25; public static readonly HASANY = 25;
public static readonly BOOL = 26; public static readonly HASALL = 26;
public static readonly NUMBER = 27; public static readonly BOOL = 27;
public static readonly QUOTED_TEXT = 28; public static readonly NUMBER = 28;
public static readonly KEY = 29; public static readonly QUOTED_TEXT = 29;
public static readonly WS = 30; public static readonly KEY = 30;
public static readonly FREETEXT = 31; public static readonly WS = 31;
public static readonly FREETEXT = 32;
public static readonly EOF = Token.EOF; public static readonly EOF = Token.EOF;
public static readonly RULE_query = 0; public static readonly RULE_query = 0;
public static readonly RULE_expression = 1; public static readonly RULE_expression = 1;
@ -87,6 +88,7 @@ export default class FilterQueryParser extends Parser {
"CONTAINS", "CONTAINS",
"IN", "NOT", "IN", "NOT",
"AND", "OR", "AND", "OR",
"HASTOKEN",
"HAS", "HASANY", "HAS", "HASANY",
"HASALL", "BOOL", "HASALL", "BOOL",
"NUMBER", "QUOTED_TEXT", "NUMBER", "QUOTED_TEXT",
@ -220,7 +222,7 @@ export default class FilterQueryParser extends Parser {
this.state = 53; this.state = 53;
this._errHandler.sync(this); this._errHandler.sync(this);
_la = this._input.LA(1); _la = this._input.LA(1);
while ((((_la) & ~0x1F) === 0 && ((1 << _la) & 3215982594) !== 0)) { while (((((_la - 1)) & ~0x1F) === 0 && ((1 << (_la - 1)) & 3218604033) !== 0)) {
{ {
this.state = 51; this.state = 51;
this._errHandler.sync(this); this._errHandler.sync(this);
@ -242,7 +244,8 @@ export default class FilterQueryParser extends Parser {
case 27: case 27:
case 28: case 28:
case 29: case 29:
case 31: case 30:
case 32:
{ {
this.state = 50; this.state = 50;
this.unaryExpression(); this.unaryExpression();
@ -808,7 +811,7 @@ export default class FilterQueryParser extends Parser {
{ {
this.state = 190; this.state = 190;
_la = this._input.LA(1); _la = this._input.LA(1);
if(!(_la===28 || _la===31)) { if(!(_la===29 || _la===32)) {
this._errHandler.recoverInline(this); this._errHandler.recoverInline(this);
} }
else { else {
@ -841,7 +844,7 @@ export default class FilterQueryParser extends Parser {
{ {
this.state = 192; this.state = 192;
_la = this._input.LA(1); _la = this._input.LA(1);
if(!((((_la) & ~0x1F) === 0 && ((1 << _la) & 58720256) !== 0))) { if(!((((_la) & ~0x1F) === 0 && ((1 << _la) & 125829120) !== 0))) {
this._errHandler.recoverInline(this); this._errHandler.recoverInline(this);
} }
else { else {
@ -996,7 +999,7 @@ export default class FilterQueryParser extends Parser {
{ {
this.state = 214; this.state = 214;
_la = this._input.LA(1); _la = this._input.LA(1);
if(!((((_la) & ~0x1F) === 0 && ((1 << _la) & 1006632960) !== 0))) { if(!((((_la) & ~0x1F) === 0 && ((1 << _la) & 2013265920) !== 0))) {
this._errHandler.recoverInline(this); this._errHandler.recoverInline(this);
} }
else { else {
@ -1045,7 +1048,7 @@ export default class FilterQueryParser extends Parser {
return localctx; return localctx;
} }
public static readonly _serializedATN: number[] = [4,1,31,219,2,0,7,0,2, public static readonly _serializedATN: number[] = [4,1,32,219,2,0,7,0,2,
1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2, 1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,
10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,1,0, 10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,1,0,
1,0,1,0,1,1,1,1,1,2,1,2,1,2,5,2,43,8,2,10,2,12,2,46,9,2,1,3,1,3,1,3,1,3, 1,0,1,0,1,1,1,1,1,2,1,2,1,2,5,2,43,8,2,10,2,12,2,46,9,2,1,3,1,3,1,3,1,3,
@ -1060,7 +1063,7 @@ export default class FilterQueryParser extends Parser {
10,9,12,9,189,9,9,1,10,1,10,1,11,1,11,1,11,1,11,1,11,1,12,1,12,1,12,5,12, 10,9,12,9,189,9,9,1,10,1,10,1,11,1,11,1,11,1,11,1,11,1,12,1,12,1,12,5,12,
201,8,12,10,12,12,12,204,9,12,1,13,1,13,1,13,3,13,209,8,13,1,14,1,14,1, 201,8,12,10,12,12,12,204,9,12,1,13,1,13,1,13,3,13,209,8,13,1,14,1,14,1,
14,1,14,1,15,1,15,1,16,1,16,1,16,0,0,17,0,2,4,6,8,10,12,14,16,18,20,22, 14,1,14,1,15,1,15,1,16,1,16,1,16,0,0,17,0,2,4,6,8,10,12,14,16,18,20,22,
24,26,28,30,32,0,5,1,0,7,8,1,0,13,14,2,0,28,28,31,31,1,0,23,25,1,0,26,29, 24,26,28,30,32,0,5,1,0,7,8,1,0,13,14,2,0,29,29,32,32,1,0,23,26,1,0,27,30,
235,0,34,1,0,0,0,2,37,1,0,0,0,4,39,1,0,0,0,6,47,1,0,0,0,8,57,1,0,0,0,10, 235,0,34,1,0,0,0,2,37,1,0,0,0,4,39,1,0,0,0,6,47,1,0,0,0,8,57,1,0,0,0,10,
70,1,0,0,0,12,149,1,0,0,0,14,163,1,0,0,0,16,180,1,0,0,0,18,182,1,0,0,0, 70,1,0,0,0,12,149,1,0,0,0,14,163,1,0,0,0,16,180,1,0,0,0,18,182,1,0,0,0,
20,190,1,0,0,0,22,192,1,0,0,0,24,197,1,0,0,0,26,208,1,0,0,0,28,210,1,0, 20,190,1,0,0,0,22,192,1,0,0,0,24,197,1,0,0,0,26,208,1,0,0,0,28,210,1,0,
@ -1112,7 +1115,7 @@ export default class FilterQueryParser extends Parser {
0,0,205,209,3,32,16,0,206,209,3,30,15,0,207,209,3,28,14,0,208,205,1,0,0, 0,0,205,209,3,32,16,0,206,209,3,30,15,0,207,209,3,28,14,0,208,205,1,0,0,
0,208,206,1,0,0,0,208,207,1,0,0,0,209,27,1,0,0,0,210,211,5,3,0,0,211,212, 0,208,206,1,0,0,0,208,207,1,0,0,0,209,27,1,0,0,0,210,211,5,3,0,0,211,212,
3,18,9,0,212,213,5,4,0,0,213,29,1,0,0,0,214,215,7,4,0,0,215,31,1,0,0,0, 3,18,9,0,212,213,5,4,0,0,213,29,1,0,0,0,214,215,7,4,0,0,215,31,1,0,0,0,
216,217,5,29,0,0,217,33,1,0,0,0,11,44,51,53,57,70,149,163,180,187,202,208]; 216,217,5,30,0,0,217,33,1,0,0,0,11,44,51,53,57,70,149,163,180,187,202,208];
private static __ATN: ATN; private static __ATN: ATN;
public static get _ATN(): ATN { public static get _ATN(): ATN {
@ -1647,6 +1650,9 @@ export class FunctionCallContext extends ParserRuleContext {
public RPAREN(): TerminalNode { public RPAREN(): TerminalNode {
return this.getToken(FilterQueryParser.RPAREN, 0); return this.getToken(FilterQueryParser.RPAREN, 0);
} }
public HASTOKEN(): TerminalNode {
return this.getToken(FilterQueryParser.HASTOKEN, 0);
}
public HAS(): TerminalNode { public HAS(): TerminalNode {
return this.getToken(FilterQueryParser.HAS, 0); return this.getToken(FilterQueryParser.HAS, 0);
} }

View File

@ -1,4 +1,4 @@
// Generated from FilterQuery.g4 by ANTLR 4.13.1 // Generated from ../../../../grammar/FilterQuery.g4 by ANTLR 4.13.1
import {ParseTreeVisitor} from 'antlr4'; import {ParseTreeVisitor} from 'antlr4';
@ -133,3 +133,4 @@ export default class FilterQueryVisitor<Result> extends ParseTreeVisitor<Result>
*/ */
visitKey?: (ctx: KeyContext) => Result; visitKey?: (ctx: KeyContext) => Result;
} }

View File

@ -74,6 +74,7 @@ export function isFunctionToken(tokenType: number): boolean {
FilterQueryLexer.HAS, FilterQueryLexer.HAS,
FilterQueryLexer.HASANY, FilterQueryLexer.HASANY,
FilterQueryLexer.HASALL, FilterQueryLexer.HASALL,
FilterQueryLexer.HASTOKEN,
].includes(tokenType); ].includes(tokenType);
} }