From 62eef2fa677a45c64122dc91c77ececf0f468ce4 Mon Sep 17 00:00:00 2001 From: PrivateGER Date: Fri, 26 May 2023 00:33:02 +0200 Subject: [PATCH] Add parsing of host, fix usernames --- packages/backend/src/db/meilisearch.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/db/meilisearch.ts b/packages/backend/src/db/meilisearch.ts index bd0514be01..c19e6b1eda 100644 --- a/packages/backend/src/db/meilisearch.ts +++ b/packages/backend/src/db/meilisearch.ts @@ -3,6 +3,7 @@ import { dbLogger } from "./logger.js"; import config from "@/config/index.js"; import {Note} from "@/models/entities/note.js"; +import * as url from "url"; const logger = dbLogger.createSubLogger("meilisearch", "gray", false); @@ -121,14 +122,14 @@ export default hasConfig ? { } } - indexingBatch.push({ + indexingBatch.push({ id: note.id.toString(), text: note.text ? note.text : "", userId: note.userId, - userHost: note.userHost ? note.userHost : "", + userHost: note.userHost !== "" ? note.userHost : url.parse(config.host).host, channelId: note.channelId ? note.channelId : "", mediaAttachment: attachmentType, - userName: note.user?.username ? note.user.username : "", + userName: note.user?.usernameLower ?? "UNKNOWN", createdAt: note.createdAt.getTime() / 1000 // division by 1000 is necessary because Node returns in ms-accuracy } )