diff --git a/packages/server/src/api/controllers/row/internalSearch.js b/packages/server/src/api/controllers/row/internalSearch.js index 8a04fc2bd0..86f1bb980a 100644 --- a/packages/server/src/api/controllers/row/internalSearch.js +++ b/packages/server/src/api/controllers/row/internalSearch.js @@ -171,10 +171,17 @@ class QueryBuilder { } const contains = (key, value) => { - if (!value && value !== 0) { + if (!Array.isArray(value) || value.length === 0) { return null } - return `${key}:${builder.preprocess(value, { escape: true })}` + let andStatement = `${builder.preprocess(value[0], { escape: true })}` + for (let i = 1; i < value.length; i++) { + andStatement += ` AND ${builder.preprocess( + value[i], + { escape: true } + )}` + } + return `${key}:(${andStatement})` } const oneOf = (key, value) => {