A JavaScript library for parsing, modifying, and stringifying Lucene query strings, built with PEG.js. Version 2.1.1 provides a stable API with a custom AST representation. It offers parse() and toString() functions to convert between query strings and structured objects. Compared to alternatives, it is lightweight and focused on query manipulation. The library is released as npm package and is in active use, though development cadence is low.
npm install luceneNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates parse() and toString() with AST modification, showing query manipulation round-trip.
Always check for existence of field before using it, e.g., ast.left.field ?? '*'
Use properties 'field' and 'term' instead of 'field' and 'value'.
Manually handle fuzzy queries or preprocess them before parsing.
Use backslash escaping for characters like + - && || ! ( ) { } [ ] ^ " ~ * ? : \Ensure the query string is complete, e.g., 'field:value OR field2:value'
Check if the node exists before accessing properties: if (ast.left) ...
Use proper syntax: 'field:value' or 'field:"value with spaces"'
No dependency data recorded yet.