import { DataType } from '@terascope/data-types' ; import { xLuceneTypeConfig , xLuceneVariables } from '@terascope/types' ; import * as p from 'xlucene-parser' ; import type { DataFrame } from '../DataFrame' ; import { buildMatcherForNode } from './buildMatcherForNode' ; export function buildSearchMatcherForQuery ( dataFrame , query , variables ? , _overrideParsedQuery ? ) { let parser = new p . Parser ( query , { type_config : frameToXluceneConfig ( dataFrame ) } , _overrideParsedQuery ) ; if ( variables ) { parser = parser . resolveVariables ( variables ) ; } return buildMatcherForNode ( dataFrame , parser . typeConfig , variables ?? { } ) ( parser . ast ) ; } function frameToXluceneConfig ( frame ) { return new DataType ( frame . config ) . toXlucene ( ) ; }