{"_id":"lucene-query-parser","_rev":"11-a91206daceaa7e041bbfad02b4b61773","name":"lucene-query-parser","time":{"modified":"2022-06-19T14:37:22.860Z","created":"2014-05-15T05:12:20.524Z","1.0.0":"2014-05-15T05:12:20.524Z","1.0.1":"2014-05-15T05:25:11.693Z","1.1.0":"2017-09-25T16:22:24.164Z","1.2.0":"2017-09-26T07:45:13.867Z"},"maintainers":[{"name":"thoward","email":"thoward37@gmail.com"}],"dist-tags":{"latest":"1.2.0"},"description":"Lucene Query Parser for JavaScript created using PEG.js","readme":"# Lucene Query Parser for JavaScript [![Build Status](https://travis-ci.org/thoward/lucene-query-parser.js.svg?branch=master)](https://travis-ci.org/thoward/lucene-query-parser.js)\r\n\r\nThis is an implementation of the Lucene Query Parser developed using PEG.js.\r\n\r\n## Example\r\n\r\nA quick example of how to use it:\r\n\r\n```javascript\r\nvar parser = require('lucene-query-parser');\r\n\r\n// return the expression tree\r\nvar results = parser.parse('title:\"The Right Way\" AND text:go');\r\n\r\nconsole.log(results['left']['field']);      // title\r\nconsole.log(results['left']['term']);       // The Right Way\r\nconsole.log(results['operator']);           // AND\r\nconsole.log(results['right']['field']);     // text\r\nconsole.log(results['right']['term']);      // go\r\n```\r\n\r\nA slightly more complicated example:\r\n\r\n```javascript\r\nvar parser = require('lucene-query-parser');\r\n\r\n// return the expression tree\r\nvar results = parser.parse('test AND (foo OR bar)');\r\n\r\nconsole.log(results['left']['term']);       // test\r\nconsole.log(results['operator']);           // AND\r\n\r\n// the grouped expression in parentheses becomes it's own nested node\r\nvar rightNode = results['right'];\r\n\r\nconsole.log(rightNode['left']['term']);     // foo\r\nconsole.log(rightNode['operator']);         // OR\r\nconsole.log(rightNode['right']['term']);    // bar\r\n```\r\n\r\nFor more detailed docs, check out [the wiki](https://github.com/thoward/lucene-query-parser.js/wiki).\r\n\r\n## Installation\r\n\r\n### On the Command-Line\r\n\r\nThe library is available as an npm module.\r\n\r\nTo install, run:\r\n\r\n```\r\nnpm install lucene-query-parser\r\n```\r\n\r\n### In the Browser\r\n\r\nIn the browser, use RequireJS to load the AMD compatible module. In the example below, it assumes there's a `~/vendor` directory for third-party libraries, with RequireJS in `~/vendor/requirejs/require.js` and our library in `~/vendor/lucene-query-parser/lucene-query-parser.js`.\r\n\r\n```html\r\n<!DOCTYPE html>\r\n<html>\r\n  <head>\r\n    <!-- RequireJS -->\r\n    <script type=\"text/javascript\" src=\"vendor/requirejs/require.js\"></script>\r\n    <!-- RequireJS -->\r\n    <script type=\"text/javascript\">\r\n      require.config({\r\n        baseUrl: './vendor/lucene-query-parser/'\r\n      });\r\n\r\n      require(['lucene-query-parser.js'], function(lucenequeryparser) {\r\n\r\n        // Use the Lucene Query Parser library here\r\n\r\n        var results = lucenequeryparser.parse('example: query');\r\n        console.log(results);\r\n      });\r\n    </script>\r\n  </head>\r\n  <body>\r\n    <!-- ... -->\r\n  </body>\r\n</html>\r\n```\r\n\r\n## Unit Tests\r\n\r\nUnit tests are built with [Jasmine](http://pivotal.github.com/jasmine/).\r\n\r\n### On the Command-line\r\n\r\nTo run the unit tests on the command line, using node:\r\n\r\n```\r\nnpm test\r\n```\r\n\r\n### In the Browser\r\n\r\nTo run the unit tests, just open [SpecRunner.html](https://rawgithub.com/thoward/lucene-query-parser.js/master/spec/SpecRunner.html) in any browser.\r\n\r\n\r\n## Grammar\r\n\r\nThe parser is auto-generated from a PEG implementation in JavaScript called [PEG.js](http://pegjs.majda.cz/).\r\n\r\nTo test the grammar without using the generated parser, or if you want to modify it, try out [PEG.js online](http://pegjs.majda.cz/online>). This is a handy way to test an arbitrary query and see what the results will be like or debug a problem with the parser for a given piece of data.\r\n\r\n\r\n## Community\r\n\r\nIf you'd like to help out with the project, or if you have a question, feel free to contact Troy Howard at thoward37@gmail.com.\r\n\r\nBug reports or feature requests should go in the GitHub [issue tracker](https://github.com/thoward/lucene-query-parser.js/issues). Please include relevant sample data (the query) and a good description of the challenges you're facing.\r\n\r\nLook to the [wiki](https://github.com/thoward/lucene-query-parser.js/wiki) for additional documentation and other resources.\r\n","versions":{"1.0.1":{"name":"lucene-query-parser","version":"1.0.1","description":"Lucene Query Parser for Javascript created using PEG.js","main":"lib/lucene-query-parser.js","scripts":{"build":"PEG_OUT=`cat lib/lucene-query.grammar | node_modules/pegjs/bin/pegjs` && printf \"if (typeof define !== 'function') { var define = require('amdefine')(module) };\n\ndefine([], function() { \nvar module = {};\n%s\nreturn module.exports;\n});\n\"  \"$PEG_OUT\" > ./lib/lucene-query-parser.js","test":"./node_modules/.bin/jasmine-node ./spec/ --verbose","prepublish":"npm run-script build && npm test"},"repository":{"type":"git","url":"git://github.com/thoward/lucene-query-parser.js.git"},"keywords":["lucene","query","parser","pegjs"],"author":{"name":"Troy Howard","email":"thoward37@gmail.com","url":"http://github.com/thoward"},"contributors":[{"name":"Eugeny Vlasenko","email":"mahnunchik@gmail.com","url":"http://mahnunchik.tumblr.com/"}],"license":"Apache 2.0","bugs":{"url":"https://github.com/thoward/lucene-query-parser.js/issues"},"dependencies":{"amdefine":">=0.0.2"},"devDependencies":{"pegjs":"0.7.x","jasmine-node":"1.10.x"},"homepage":"https://github.com/thoward/lucene-query-parser.js","_id":"lucene-query-parser@1.0.1","dist":{"shasum":"8ebbac0719671e18ada25e572481d2d16bf3cca3","tarball":"https://registry.npmjs.org/lucene-query-parser/-/lucene-query-parser-1.0.1.tgz","integrity":"sha512-rcEg7sF0T12VExmQrzKkcZjLxoyxgCcEUTAGDaHyQGr9DSSY8d/gXArOaUYzfPiVAYKBvM3R64bPCsE/5Fh6WQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAXb+rU98ZV+IdMNo7MPWKocGR+8Fmr/VYRODlbczoJsAiEA5GDPt09DFkhN2H9HZrbzR/A29VqChbvqNF5n1ExHq0o="}]},"_from":".","_npmVersion":"1.3.21","_npmUser":{"name":"thoward","email":"thoward37@gmail.com"},"maintainers":[{"name":"thoward","email":"thoward37@gmail.com"}]},"1.1.0":{"name":"lucene-query-parser","version":"1.1.0","description":"Lucene Query Parser for JavaScript created using PEG.js","main":"lib/lucene-query-parser.js","scripts":{"build":"PEG_OUT=`cat lib/lucene-query.grammar | node_modules/pegjs/bin/pegjs` && printf \"if (typeof define !== 'function') { var define = require('amdefine')(module) };\n\ndefine([], function() { \nvar module = {};\n%s\nreturn module.exports;\n});\n\"  \"$PEG_OUT\" > ./lib/lucene-query-parser.js","test":"jasmine-node ./spec/ --verbose","prepublish":"npm run-script build && npm test"},"repository":{"type":"git","url":"git://github.com/thoward/lucene-query-parser.js.git"},"keywords":["lucene","query","parser","pegjs"],"author":{"name":"Troy Howard","email":"thoward37@gmail.com","url":"http://github.com/thoward"},"contributors":[{"name":"Troy Howard","email":"thoward37@gmail.com","url":"https://github.com/thoward"},{"name":"Bastien Vaucher","url":"https://github.com/bastien"},{"name":"Bruce He","email":"heganjie@gmail.com","url":"https://github.com/HeGanjie"},{"name":"Evgeny","email":"mahnunchik@gmail.com","url":"https://github.com/mahnunchik"},{"name":"matthiasg","email":"m.goetzke@curasystems.de","url":"https://github.com/matthiasg"},{"name":"Cameron Davison","email":"cameron.davison@gmail.com","url":"https://github.com/a86c6f7964"},{"name":"Matthieu Maitre","url":"https://github.com/mmaitre314"}],"license":"Apache 2.0","bugs":{"url":"https://github.com/thoward/lucene-query-parser.js/issues"},"dependencies":{"amdefine":">=0.0.2"},"devDependencies":{"jasmine-node":"1.10.x","pegjs":"0.8.x"},"gitHead":"a9916de8a711baedcdcdcc411343a052653e6a88","homepage":"https://github.com/thoward/lucene-query-parser.js#readme","_id":"lucene-query-parser@1.1.0","_shasum":"de6f84a84e23076de1a15d5b511ebba2ee6cbfc6","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.2","_npmUser":{"name":"thoward","email":"thoward37@gmail.com"},"maintainers":[{"name":"thoward","email":"thoward37@gmail.com"}],"dist":{"shasum":"de6f84a84e23076de1a15d5b511ebba2ee6cbfc6","tarball":"https://registry.npmjs.org/lucene-query-parser/-/lucene-query-parser-1.1.0.tgz","integrity":"sha512-9+x9Fn+qyj2k763LkVm0xKQMDiAkhnD6bu1LcAlbpCAQOvygtH+GHGjoTbHX23ANtd8XykF/H3jOoE0BmTdvHw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC/V+m1ZLiep2eCLdgNOo23Kav1jBisqZq74g2wzguBrQIhALZMFE651xGfdabZk8bRarg7a2s0Dc/y42ObVsc1k88n"}]},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/lucene-query-parser-1.1.0.tgz_1506356544056_0.0928398638498038"}},"1.2.0":{"name":"lucene-query-parser","version":"1.2.0","description":"Lucene Query Parser for JavaScript created using PEG.js","main":"lib/lucene-query-parser.js","scripts":{"build":"node_modules/pegjs/bin/pegjs --format umd --export-var lucenequeryparser -o lib/lucene-query-parser.js lib/lucene-query.grammar","test":"jasmine spec/lucene-query-parser.spec.js","prepublish":"npm run-script build && npm test"},"repository":{"type":"git","url":"git://github.com/thoward/lucene-query-parser.js.git"},"keywords":["lucene","query","parser","pegjs"],"author":{"name":"Troy Howard","email":"thoward37@gmail.com","url":"http://github.com/thoward"},"contributors":[{"name":"Troy Howard","email":"thoward37@gmail.com","url":"https://github.com/thoward"},{"name":"Bastien Vaucher","url":"https://github.com/bastien"},{"name":"Bruce He","email":"heganjie@gmail.com","url":"https://github.com/HeGanjie"},{"name":"Evgeny","email":"mahnunchik@gmail.com","url":"https://github.com/mahnunchik"},{"name":"matthiasg","email":"m.goetzke@curasystems.de","url":"https://github.com/matthiasg"},{"name":"Cameron Davison","email":"cameron.davison@gmail.com","url":"https://github.com/a86c6f7964"},{"name":"Matthieu Maitre","url":"https://github.com/mmaitre314"}],"license":"Apache 2.0","bugs":{"url":"https://github.com/thoward/lucene-query-parser.js/issues"},"devDependencies":{"amdefine":">=0.0.2","jasmine":"~2.8.0","jasmine-core":"~2.8.0","pegjs":"0.10.x"},"gitHead":"b1b11ba4060b490b77c01077e489cf8118511a9d","homepage":"https://github.com/thoward/lucene-query-parser.js#readme","_id":"lucene-query-parser@1.2.0","_shasum":"46dad5b4ddc59abbf27f9df4c519d959c2033432","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.2","_npmUser":{"name":"thoward","email":"thoward37@gmail.com"},"maintainers":[{"name":"thoward","email":"thoward37@gmail.com"}],"dist":{"shasum":"46dad5b4ddc59abbf27f9df4c519d959c2033432","tarball":"https://registry.npmjs.org/lucene-query-parser/-/lucene-query-parser-1.2.0.tgz","integrity":"sha512-ZWbguSNYKmFEgw7+lfD4t9MKZkH0VlzidFRLaUJO+XnIYWp8MQxJI5ArpVEzLMIApZVT5Qias+dvLGu6ABtNMw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBS45v2VuGOFeA8K4pWTjKy4jWZmtgwnPokB1hvcDmchAiAGKEcqpSnmvq6yI7k6XNn90CyHXKnXvGTz2hLWTbeDUg=="}]},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/lucene-query-parser-1.2.0.tgz_1506411913775_0.04017810430377722"}}},"homepage":"https://github.com/thoward/lucene-query-parser.js#readme","keywords":["lucene","query","parser","pegjs"],"repository":{"type":"git","url":"git://github.com/thoward/lucene-query-parser.js.git"},"contributors":[{"name":"Troy Howard","email":"thoward37@gmail.com","url":"https://github.com/thoward"},{"name":"Bastien Vaucher","url":"https://github.com/bastien"},{"name":"Bruce He","email":"heganjie@gmail.com","url":"https://github.com/HeGanjie"},{"name":"Evgeny","email":"mahnunchik@gmail.com","url":"https://github.com/mahnunchik"},{"name":"matthiasg","email":"m.goetzke@curasystems.de","url":"https://github.com/matthiasg"},{"name":"Cameron Davison","email":"cameron.davison@gmail.com","url":"https://github.com/a86c6f7964"},{"name":"Matthieu Maitre","url":"https://github.com/mmaitre314"}],"author":{"name":"Troy Howard","email":"thoward37@gmail.com","url":"http://github.com/thoward"},"bugs":{"url":"https://github.com/thoward/lucene-query-parser.js/issues"},"license":"Apache 2.0","readmeFilename":"README.md","users":{"jden":true,"jsdnxx":true}}