From cf8a733927608d5a04cc6e92921b4c0773af48d6 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Wed, 9 Aug 2023 19:39:01 -0700 Subject: [PATCH] refactor: :children_crossing: only index public posts --- packages/backend/src/server/api/endpoints/notes/search.ts | 1 + packages/backend/src/services/note/create.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/server/api/endpoints/notes/search.ts b/packages/backend/src/server/api/endpoints/notes/search.ts index 21ee7f48e..8c5798b62 100644 --- a/packages/backend/src/server/api/endpoints/notes/search.ts +++ b/packages/backend/src/server/api/endpoints/notes/search.ts @@ -85,6 +85,7 @@ export default define(meta, paramDef, async (ps, me) => { query .andWhere("note.text ILIKE :q", { q: `%${sqlLikeEscape(ps.query)}%` }) + .andWhere("note.visibility = 'public'") .innerJoinAndSelect("note.user", "user") .leftJoinAndSelect("user.avatar", "avatar") .leftJoinAndSelect("user.banner", "banner") diff --git a/packages/backend/src/services/note/create.ts b/packages/backend/src/services/note/create.ts index adebc22a4..b7704946f 100644 --- a/packages/backend/src/services/note/create.ts +++ b/packages/backend/src/services/note/create.ts @@ -806,7 +806,7 @@ async function insertNote( } export async function index(note: Note, reindexing: boolean): Promise { - if (!note.text) return; + if (!note.text || note.visibility === "public") return; if (config.elasticsearch && es) { es.index({