From d3c7e7ea8ed8385a14219a9728fba4e84b8a3096 Mon Sep 17 00:00:00 2001 From: Simon Cambier Date: Fri, 11 Jul 2025 18:22:44 +0200 Subject: [PATCH] Fixed date "bug" --- src/search/search-engine.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/search/search-engine.ts b/src/search/search-engine.ts index fa8aa1c..e1c3368 100644 --- a/src/search/search-engine.ts +++ b/src/search/search-engine.ts @@ -190,15 +190,16 @@ export class SearchEngine { } const mtime = storedFields?.mtime as number const now = new Date().valueOf() - const daysElapsed = (now - mtime) / (24 * 3600) - + const daysElapsed = (now - mtime) / (24 * 3600_000) // Documents boost const cutoff = { [RecencyCutoff.Day]: -3, [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)) + ) }, })