Comments (4)
Most likely an issue with the grammar. The grammar is far from correct. Feel free to contribute a fix :)
from lucene.
Looked into this again, the query you defined is not valid according to official lucene query parser (the one written in Java):
Exception in thread "main" org.apache.lucene.queryparser.classic.ParseException: Cannot parse 'foo~bar:"hello"': Encountered " ":" ": "" at line 1, column 7.
Was expecting one of:
<EOF>
<AND> ...
<OR> ...
<NOT> ...
"+" ...
"-" ...
<BAREOPER> ...
"(" ...
"*" ...
"^" ...
<QUOTED> ...
<TERM> ...
<PREFIXTERM> ...
<WILDTERM> ...
<REGEXPTERM> ...
"[" ...
"{" ...
<NUMBER> ...
What would be valid, is an escaped tilde in the keyword, i.e. foo\~bar:"hello"
from lucene.
Which unfortunately is also misunderstood by this library :/
> require('.').parse('foo\~bar:"hello"')
{ left:
{ field: '<implicit>',
term: 'foo',
quoted: false,
similarity: 0.5,
boost: null,
prefix: null },
operator: '<implicit>',
right:
{ field: 'bar',
term: 'hello',
quoted: true,
proximity: null,
boost: null,
prefix: null } }
> require('.').parse('foo\\~bar:"hello"')
{ left:
{ field: '<implicit>',
term: 'foo\\',
quoted: false,
similarity: 0.5,
boost: null,
prefix: null },
operator: '<implicit>',
right:
{ field: 'bar',
term: 'hello',
quoted: true,
proximity: null,
boost: null,
prefix: null } }
>
from lucene.
Escaping strategy has been changed with release 2.0.0 such that this issue no longer applies. In addition, this module now provides helpers for easy escaping/unescaping.
from lucene.
Related Issues (20)
- `/` in the query results in parse error HOT 6
- Whitespace after opening parenthesis is breaking parser HOT 3
- ES6 modules HOT 3
- AST explorer HOT 4
- Problem stringifying the AST with a parenthesized negated expression HOT 3
- Grammar potentially incorrectly parses fields with whitespaces before terms HOT 1
- Grouping order for query like "𝑎 AND 𝑏 AND 𝑐"
- Support for lower case operators HOT 1
- Possible to parse escaped quotes? HOT 3
- Anti-slashes are not properly handled HOT 2
- support regex options HOT 1
- "AND NOT" is mishandled HOT 1
- Falsy numbers as term values lead to invalid queries in toString()
- Improve escaping support
- Greater than, less than etc? HOT 1
- Named field fuzzy search?
- Date rounding is reported as an error HOT 2
- Malformed return queries from the toString operation HOT 3
- Can't parse range query string with colon symbol HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lucene.