Open ebbersjathomes opened 9 years ago
Thanks for the report, we'll look in to it as soon as possible.
Confirmed the above generates an invalid lucene query.
This is currently by design because we want advanced users to be able to enter valid lucene queries.
@joeandaverde submitted a PR that never quite got merged for a similar issue regarding email address tokenization.
I propose we start always escaping strings because that seems to be the expected behaviour, and introduce a new schema type called "lucene" (or something better) for passing lucene query snippets. For example:
var generator = require('lucene-query-generator');
console.log(generator.convert({
$operands: [
{ state: 'OR' }
]
}));
//state:"OR"
console.log(generator.convert({
$operands: [
{ state: 'OR' }
]
}, {
schema: {
state: 'lucene'
}
}));
//state:OR (which errors in lucene as expected)
@ebbersjathomes Does that make sense to you?
Proposal supported on my end; +1.