From 38caacfa4f5677af0609424cd56b0fed89e9b4cb Mon Sep 17 00:00:00 2001 From: Simon Cambier Date: Thu, 10 Jul 2025 18:05:16 +0200 Subject: [PATCH] Fixed #472 --- src/search/search-engine.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/search/search-engine.ts b/src/search/search-engine.ts index 9d2a41b..6cb8451 100644 --- a/src/search/search-engine.ts +++ b/src/search/search-engine.ts @@ -190,7 +190,8 @@ export class SearchEngine { } const mtime = storedFields?.mtime as number const now = new Date().valueOf() - const daysElapsed = (now - mtime) / (24 * 3600) + console.log(now) + const daysElapsed = (now - mtime) / (24 * 3600_000) // Documents boost const cutoff = { @@ -198,7 +199,9 @@ export class SearchEngine { [RecencyCutoff.Week]: -0.3, [RecencyCutoff.Month]: -0.1, } as const - return 1 + Math.exp(cutoff[settings.recencyBoost] * daysElapsed) + return ( + 1 + Math.exp(cutoff[settings.recencyBoost] * (daysElapsed / 1000)) + ) }, }) @@ -331,9 +334,7 @@ export class SearchEngine { results.map(async result => { const doc = await this.plugin.documentsRepository.getDocument(result.id) if (!doc) { - console.warn( - `Omnisearch - Note "${result.id}" not in the live cache` - ) + console.warn(`Omnisearch - Note "${result.id}" not in the live cache`) countError(true) } return doc