From 60f81014df7e1cc609150864322b5559b8a27ee7 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 2 Sep 2021 12:00:18 +0100 Subject: [PATCH] Fix indexing of rows with arrays of objects --- packages/server/src/db/views/staticViews.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/server/src/db/views/staticViews.js b/packages/server/src/db/views/staticViews.js index 6e52e9699c..8e7b101ef5 100644 --- a/packages/server/src/db/views/staticViews.js +++ b/packages/server/src/db/views/staticViews.js @@ -100,11 +100,11 @@ exports.createAllSearchIndex = async appId => { let idxKey = prev != null ? `${prev}.${key}` : key idxKey = idxKey.replace(/ /, "_") if (Array.isArray(input[key])) { - for (let val in input[key]) { - // eslint-disable-next-line no-undef - index(idxKey, input[key][val], { - store: true, - }) + for (let val of input[key]) { + if (typeof val !== "object") { + // eslint-disable-next-line no-undef + index(idxKey, val, { store: true }) + } } } else if (key === "_id" || key === "_rev" || input[key] == null) { continue