From 5cd0f09726bc5d45db581c7e7291bf0be14785e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Rie=C3=9F?= Date: Sun, 16 Jul 2023 22:45:26 +0200 Subject: [PATCH] Add page names to search index (#474) --- plugs/search/engine.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugs/search/engine.ts b/plugs/search/engine.ts index 0e13e739..55d0b027 100644 --- a/plugs/search/engine.ts +++ b/plugs/search/engine.ts @@ -49,7 +49,9 @@ export class SimpleSearchEngine { const updateIndexMap = new Map(); const updateReverseIndexMap = new Map(); - const words = this.tokenize(document.text); + const pageContent = this.tokenize(document.text); + const pageName = this.tokenize(document.id); + const words = [...pageContent, ...pageName]; const filteredWords = this.removeStopWords(words); const stemmedWords = filteredWords.map((word) => this.stem(word));