{"library":"lucene-query-parser","title":"Lucene Query Parser for JavaScript","description":"This library offers a JavaScript implementation of the Lucene query parser, allowing applications to translate Lucene-style query strings into an Abstract Syntax Tree (AST). It was developed using PEG.js, a parser generator. The current stable version is 1.2.0, which was released in 2017. The project appears to be abandoned, with no significant updates or commits in several years. Its key differentiator is providing a direct JavaScript port of the Lucene query parsing logic, enabling both client-side and server-side (Node.js) applications to interpret complex search queries adhering to Lucene syntax. Users should be aware of its inactive development status and potential compatibility challenges with modern JavaScript ecosystems, especially concerning ES Modules (ESM) or newer Node.js features, as it predates widespread adoption of these standards.","language":"javascript","status":"abandoned","last_verified":"Sun Apr 19","install":{"commands":["npm install lucene-query-parser"],"cli":null},"imports":["const parser = require('lucene-query-parser');","require(['lucene-query-parser.js'], function(lucenequeryparser) { /* ... */ });"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const parser = require('lucene-query-parser');\n\n// Basic query parsing example\nconst results1 = parser.parse('title:\"The Right Way\" AND text:go');\n\nconsole.log('--- Example 1: Basic Query ---');\nconsole.log(`Left field: ${results1['left']['field']}`);\nconsole.log(`Left term: ${results1['left']['term']}`);\nconsole.log(`Operator: ${results1['operator']}`);\nconsole.log(`Right field: ${results1['right']['field']}`);\nconsole.log(`Right term: ${results1['right']['term']}`);\n\n// More complex query with grouping\nconst results2 = parser.parse('test AND (foo OR bar)');\n\nconsole.log('\\n--- Example 2: Grouped Query ---');\nconsole.log(`Left term: ${results2['left']['term']}`);\nconsole.log(`Operator: ${results2['operator']}`);\n\nconst rightNode = results2['right']; // The grouped expression is a nested node\n\nconsole.log(`Nested left term: ${rightNode['left']['term']}`);\nconsole.log(`Nested operator: ${rightNode['operator']}`);\nconsole.log(`Nested right term: ${rightNode['right']['term']}`);\n","lang":"javascript","description":"Demonstrates how to parse simple and grouped Lucene query strings into an AST and access the parsed components.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}