Fixing an issue with lucene equality searching, strings weren't handled correctly.

This commit is contained in:
mike12345567 2021-07-19 14:31:06 +01:00
parent ec19ff23c2
commit 65358cf10d
1 changed files with 6 additions and 2 deletions

View File

@ -148,12 +148,16 @@ class QueryBuilder {
} }
if (this.query.equal) { if (this.query.equal) {
build(this.query.equal, (key, value) => { build(this.query.equal, (key, value) => {
return value ? `${key}:${luceneEscape(value.toLowerCase())}` : null const escapedValue = luceneEscape(value.toLowerCase())
// have to do the or to manage straight values, or strings
return value ? `(${key}:${escapedValue} OR ${key}:"${escapedValue}")` : null
}) })
} }
if (this.query.notEqual) { if (this.query.notEqual) {
build(this.query.notEqual, (key, value) => { build(this.query.notEqual, (key, value) => {
return value ? `!${key}:${luceneEscape(value.toLowerCase())}` : null const escapedValue = luceneEscape(value.toLowerCase())
// have to do the or to manage straight values, or strings
return value ? `(!${key}:${escapedValue} OR !${key}:"${escapedValue}")` : null
}) })
} }
if (this.query.empty) { if (this.query.empty) {