Skip to main content

xlucene-parser / functions

functions

Enumerations

EnumerationDescription
xLuceneFunctionEnumeration of available xLucene functions.

Variables

xLuceneFunctions

const xLuceneFunctions: Record<xLuceneFunction, FunctionDefinition>

Defined in: packages/xlucene-parser/src/functions/index.ts:27

Registry of available xLucene function implementations.

Maps function names to their corresponding function definitions that provide the implementation logic.

Functions

initFunction()

initFunction(config): FunctionMethods

Defined in: packages/xlucene-parser/src/functions/index.ts:57

Initialize a function node with the appropriate implementation.

This function looks up the function implementation based on the node's name and creates an instance configured with the provided variables and type config.

Parameters

ParameterTypeDescription
config{ node: FunctionNode; type_config: xLuceneTypeConfig; variables?: xLuceneVariables; }Configuration object
config.nodeFunctionNodeThe function node from the AST
config.type_configxLuceneTypeConfigField type configuration
config.variables?xLuceneVariablesVariables for parameter resolution

Returns

FunctionMethods

Function methods for matching and query generation

Throws

If the function name is not recognized

Example

const functionMethods = initFunction({
node: geoDistanceNode,
variables: { maxDist: '10km' },
type_config: { location: 'geo' }
});