bripkens / lucene

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

Grammar potentially incorrectly parses fields with whitespaces before terms #32

Closed freedmand closed 4 years ago

freedmand commented 4 years ago

Firstly, many thanks for the great library!

I have been testing it a lot and found what I believe to be a small issue. Parsing a field with one or more spaces after the colon followed by another term incorrectly groups the term with the field.

Example: color:     red parses as

{
   "left": {
      "field": "color",
      "term": "red",
      ...
   }
}

I would expect it to parse as a syntax error or two separate terms. I am by no means an expert so I could be mistaken.

bripkens commented 4 years ago

Hey @freedmand,

actually this behavior is consistent to the reference implementation of lucene (the Java based one). I tried your query with it and it behaves the same:

image

I'll therefore close this issue as there is nothing to do for this library.