Skip to main content

xlucene-parser / parser / Parser

Class: Parser

Parse a xLucene query

Constructors

new Parser()

new Parser(query, options?, _overrideNode?): Parser

Parameters

ParameterType
querystring
options?ParserOptions
_overrideNode?Node

Returns

Parser

Source

xlucene-parser/src/parser.ts:23

Properties

ast

readonly ast: Node

Source

xlucene-parser/src/parser.ts:18


filterNilVariables

readonly filterNilVariables: boolean

Source

xlucene-parser/src/parser.ts:21


query

readonly query: string

Source

xlucene-parser/src/parser.ts:19


typeConfig

readonly typeConfig: xLuceneTypeConfig

Source

xlucene-parser/src/parser.ts:20

Methods

filterNodes()

filterNodes(ast, fn): Node

Parameters

ParameterType
astNode
fn(node, parent?) => boolean

Returns

Node

Source

xlucene-parser/src/parser.ts:89


forEachFieldValue()

forEachFieldValue(cb): void

Iterate over all of the field value from Term-Like nodes, this is useful for validating values and variables.

Parameters

ParameterType
cb(value, node) => void

Returns

void

Source

xlucene-parser/src/parser.ts:267


forEachTermNode()

forEachTermNode(fieldValidator, valueValidator): void

Parameters

ParameterType
fieldValidator(field) => void
valueValidator(fieldValue) => void

Returns

void

Source

xlucene-parser/src/parser.ts:289


forTermTypes()

forTermTypes(cb, skipFunctionParams): void

Iterate over all of the Term-Like nodes.

Parameters

ParameterTypeDefault value
cb(node) => voidundefined
skipFunctionParamsbooleantrue

Returns

void

Source

xlucene-parser/src/parser.ts:252


forTypes()

forTypes<T>(types, cb, skipFunctionParams): void

Recursively Iterate over all or select set of the nodes types

Type parameters

Type parameter
T extends readonly NodeType[] | NodeType[]

Parameters

ParameterTypeDefault value
typesTundefined
cb(node) => voidundefined
skipFunctionParamsbooleanfalse

Returns

void

Source

xlucene-parser/src/parser.ts:212


mapNode()

mapNode(fn): Node

Map the Node and return a new Node

Parameters

ParameterType
fn(node, parent?) => Node

Returns

Node

Source

xlucene-parser/src/parser.ts:391


resolveVariables()

resolveVariables(variables): Parser

Validate and resolve the variables, returns a new Parser instance

Parameters

ParameterType
variablesxLuceneVariables

Returns

Parser

Source

xlucene-parser/src/parser.ts:358