bripkens / lucene

Node.js lib to transform: lucene query → syntax tree → lucene query
MIT License
72 stars 33 forks source link

support grammer whitespace between colon(:) and term; support lowerca… #12

Closed ghost closed 6 years ago

ghost commented 6 years ago

added two pieces:

  1. support grammer whitespace between colon(:) and term;
  2. support lowercase conjunction operators (and, or, not)
const query = 'hello: world and ok: true'
coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.7%) to 80.461% when pulling 4975068cb249143a2c9589e0a8f216b905dcab12 on uxnow:feature-grammer into 9a1d6f6402b62189930d0fde179d897594df2c5d on bripkens:master.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.6%) to 80.391% when pulling d7c0f273a443fb800273784cf03385c14db51782 on uxnow:feature-grammer into 9a1d6f6402b62189930d0fde179d897594df2c5d on bripkens:master.

bripkens commented 6 years ago

Hey @uxnow,

thank you for this PR! Let's talk about each part of it separately:

support grammer whitespace between colon(:) and term;

I like this change and your proposed behavior adheres to Java Lucene's own behavior 👍

support lowercase conjunction operators (and, or, not)

This would be a deviation from the lucene query syntax. Check out the following screenshot which shows how the lucene query parser (the official Java one) handles lower case or (full example query is: foo or bar).

screen shot 2017-11-24 at 08 24 23

I am not willing to accept this part of the PR as it is a deviation from the lucene query syntax.

bripkens commented 6 years ago

From the official website:

Boolean operators allow terms to be combined through logic operators. Lucene supports AND, "+", OR, NOT and "-" as Boolean operators (Note: Boolean operators must be ALL CAPS).

https://lucene.apache.org/core/2_9_4/queryparsersyntax.html#Boolean operators

ghost commented 6 years ago

@bripkens thank you for so rapid response.

for the part 2, the fact is our customers want the feature of using lowercase logic operators.

As you mentioned, It is not an official recommended feature, so I will issue another pull request later.

thank you for showing the link from the official website.