From 65358cf10d3cfdf13da8b2aac8f0e266a5854626 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 19 Jul 2021 14:31:06 +0100 Subject: [PATCH] Fixing an issue with lucene equality searching, strings weren't handled correctly. --- packages/server/src/api/controllers/row/internalSearch.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/server/src/api/controllers/row/internalSearch.js b/packages/server/src/api/controllers/row/internalSearch.js index 7225ab633a..91cfdcbcb6 100644 --- a/packages/server/src/api/controllers/row/internalSearch.js +++ b/packages/server/src/api/controllers/row/internalSearch.js @@ -148,12 +148,16 @@ 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) {