diff --git a/apps/gp2-server/src/handlers/news/algolia-index-handler.ts b/apps/gp2-server/src/handlers/news/algolia-index-handler.ts index 58cee6f000..aad368df62 100644 --- a/apps/gp2-server/src/handlers/news/algolia-index-handler.ts +++ b/apps/gp2-server/src/handlers/news/algolia-index-handler.ts @@ -25,8 +25,13 @@ export const indexNewsHandler = const news = await newsController.fetchById(id); log.debug(`Fetched news ${news.id}`); + const data = { + ...news, + _tags: news.tags, + }; + await algoliaClient.save({ - data: news, + data, type: 'news', }); diff --git a/apps/gp2-server/test/handlers/news/algolia-index-handler.test.ts b/apps/gp2-server/test/handlers/news/algolia-index-handler.test.ts index a33ea7863e..13d6c4a24e 100644 --- a/apps/gp2-server/test/handlers/news/algolia-index-handler.test.ts +++ b/apps/gp2-server/test/handlers/news/algolia-index-handler.test.ts @@ -24,7 +24,7 @@ describe('News index handler', () => { await indexHandler(publishedEvent('42')); expect(algoliaSearchClientMock.save).toHaveBeenCalledWith({ - data: newsResponse, + data: { ...newsResponse, _tags: newsResponse.tags }, type: 'news', }); });