perf(plugin-search): improve search cache (#451)

This commit is contained in:
pengzhanbo 2025-01-28 00:26:51 +08:00 committed by GitHub
parent 149d31818f
commit 4ed2ed49a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -92,7 +92,8 @@ export async function onSearchIndexRemoved(
const locale = page.pathLocale
const index = getIndexByLocale(locale, searchOptions)
const cache = getIndexCache(fileId)
index.removeAll(cache)
if (cache && cache.length)
index.removeAll(cache)
await writeTemp(app)
}
}