This commit is contained in:
Simon Cambier
2025-07-10 18:05:16 +02:00
parent a7084de6ea
commit 38caacfa4f

View File

@@ -190,7 +190,8 @@ export class SearchEngine {
} }
const mtime = storedFields?.mtime as number const mtime = storedFields?.mtime as number
const now = new Date().valueOf() const now = new Date().valueOf()
const daysElapsed = (now - mtime) / (24 * 3600) console.log(now)
const daysElapsed = (now - mtime) / (24 * 3600_000)
// Documents boost // Documents boost
const cutoff = { const cutoff = {
@@ -198,7 +199,9 @@ export class SearchEngine {
[RecencyCutoff.Week]: -0.3, [RecencyCutoff.Week]: -0.3,
[RecencyCutoff.Month]: -0.1, [RecencyCutoff.Month]: -0.1,
} as const } 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 => { results.map(async result => {
const doc = await this.plugin.documentsRepository.getDocument(result.id) const doc = await this.plugin.documentsRepository.getDocument(result.id)
if (!doc) { if (!doc) {
console.warn( console.warn(`Omnisearch - Note "${result.id}" not in the live cache`)
`Omnisearch - Note "${result.id}" not in the live cache`
)
countError(true) countError(true)
} }
return doc return doc