2.1.1 • Published 5 years ago

lucene v2.1.1

Weekly downloads
4,707
License
MIT
Repository
github
Last release
5 years ago

lucene   Build Status Dependency Status Coverage Status npm version

Parse, modify and stringify lucene queries.

Installation | Try It | Usage | Grammar | History


Installation

npm install --save lucene
-or-
yarn add lucene

Usage

const lucene = require('lucene');

const ast = lucene.parse('name:frank OR job:engineer');
console.log(ast);
// {
//   left: {
//     field: 'name',
//     term: 'frank'
//   },
//   operator: 'OR',
//   right: {
//     field: 'job',
//     term: 'engineer'
//   }
// }

console.log(lucene.toString(ast));
// name:frank OR job:engineer

Grammar

The parser is auto-generated from a PEG implementation in JavaScript called PEG.js.

To test the grammar without using the generated parser, or if you want to modify it, try out PEG.js online. This is a handy way to test arbitrary queries and see what the results will be like or debug a problem with the parser for a given piece of data.

History

This project is based on thoward/lucene-query-parser.js and its forks (most notably xomyaq/lucene-queryparser). The project is forked to allow some broader changes to the API surface area, project structure and additional capabilities.

2.1.1

5 years ago

2.1.0

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago