Fixed date "bug"

This commit is contained in:
Simon Cambier 2025-07-11 18:22:44 +02:00
parent 99fd363c22
commit d3c7e7ea8e

View File

@ -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))
)
},
})