diff --git a/packages/server/src/api/controllers/row/internalSearch.js b/packages/server/src/api/controllers/row/internalSearch.js index 7225ab633a..72f5e6e5c8 100644 --- a/packages/server/src/api/controllers/row/internalSearch.js +++ b/packages/server/src/api/controllers/row/internalSearch.js @@ -148,12 +148,20 @@ class QueryBuilder { } if (this.query.equal) { 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) { 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) {