bripkens / lucene

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

Can't parse range query string with colon symbol #9

Closed Lotti closed 6 years ago

Lotti commented 6 years ago

try to parse this lucene string:

"creation_date:[2017-06-09T10:18:33Z TO 2017-06-09T10:18:33Z]"

and you'll get this:

{
  "message": "Expected \".\", \"TO\", [^: \\t\\r\\n\\f{}()\"\\/\\^~[\\]] or whitespace but \":\" found.",
  "expected": [
    {
      "type": "literal",
      "value": ".",
      "description": "\".\""
    },
    {
      "type": "literal",
      "value": "TO",
      "description": "\"TO\""
    },
    {
      "type": "class",
      "value": "[^: \\t\\r\\n\\f{}()\"\\/\\^~[\\]]",
      "description": "[^: \\t\\r\\n\\f{}()\"\\/\\^~[\\]]"
    },
    {
      "type": "other",
      "description": "whitespace"
    }
  ],
  "found": ":",
  "offset": 28,
  "line": 1,
  "column": 29,
  "name": "SyntaxError"
}
Lotti commented 6 years ago

I did a fix: https://github.com/bripkens/lucene/pull/10

bripkens commented 6 years ago

Fix provided by @Lotti, merged and released.