The `xlucene-translator` package is a core component within the Teraslice monorepo, specifically designed to convert xLucene syntax queries into various target database query formats. This provides a standardized query language layer, abstracting the complexities of different data backend syntaxes. The current stable version, derived from the Teraslice monorepo, is v3.6.1, with frequent updates that align with the active development cadence of the larger Teraslice project. Its primary differentiation lies in offering a flexible and unified translation interface, which is crucial for applications that need to query data across heterogeneous data stores, such as Elasticsearch or OpenSearch. The package is built for Node.js environments (requiring Node.js >=22.0.0) and ships with comprehensive TypeScript type definitions, enhancing developer experience and type safety.
npm install xlucene-translatorVerified import paths — ran on the pinned version, not inferred.
Demonstrates initializing an Elasticsearch translator with a field mapping object and translating two different xLucene queries into their corresponding Elasticsearch Query DSL representations.
Upgrade your Node.js runtime to version 22.0.0 or greater. If using pnpm, ensure your `pnpm` version is also updated to >=10.25.0 to meet engine requirements.
Ensure that the `fieldMapping` object accurately mirrors the schema (including data types) of your target database for all fields used in xLucene queries. This is critical for generating valid and effective database queries.
Always refer to the official Teraslice release notes and changelogs for coordinated updates across its internal packages. Prioritize updating `xlucene-translator` via Teraslice's recommended upgrade paths.
Verify the dialect string against the package's documentation for a list of supported database dialects (e.g., 'elasticsearch', 'opensearch').
Carefully review the xLucene query for any typos, incorrect operators, missing quotes, or malformed field-value pairs. Consult the xLucene specification for correct syntax guidelines.
Ensure that every field mentioned in your xLucene query string has a corresponding entry in the `fieldMapping` object, and that each entry includes a valid `type` property (e.g., `{ type: 'keyword' }`).No dependency data recorded yet.