From de18b94c3e763114dd9411a56791604193c73977 Mon Sep 17 00:00:00 2001 From: Monkey Do Date: Mon, 18 Nov 2019 16:56:37 +0100 Subject: [PATCH] fix(search): Index areas properly Areas are not indexed since PR #313 --- src/server/helpers/search.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/server/helpers/search.js b/src/server/helpers/search.js index 90baf5a620..8d9d6527ec 100644 --- a/src/server/helpers/search.js +++ b/src/server/helpers/search.js @@ -343,11 +343,17 @@ export async function generateIndex(orm) { .fetchAll(); const areas = areaCollection.toJSON(); + + /** To index names, we use aliasSet.aliases.name and bbid, which Areas don't have. + * We massage the area to return a similar format as BB entities + */ const processedAreas = areas.map((area) => new Object({ - bbid: area.gid, - defaultAlias: { - name: area.name + aliasSet: { + aliases: [ + {name: area.name} + ] }, + bbid: area.gid, type: 'Area' })); await _processEntityListForBulk(processedAreas);