Improve search result page

This commit is contained in:
2026-07-20 08:54:10 +02:00
parent d0325fdec5
commit 5303645173
5 changed files with 258 additions and 68 deletions
+10 -3
View File
@@ -41,6 +41,7 @@ func hashAsset(name string) string {
// cache-bust its lazy bundle load the same way the edit template does.
var tmplFuncs = template.FuncMap{
"editorBundleVersion": func() string { return editorBundleVersion },
"fileIcon": fileIcon,
}
var (
@@ -133,13 +134,19 @@ func main() {
// so the first search after a cold start still returns correct results.
go func() {
folderIndex.buildMu.Lock()
entries := buildFolderIndex(root)
folders, files := buildIndexes(root)
now := time.Now()
folderIndex.Lock()
folderIndex.entries = entries
folderIndex.builtAt = time.Now()
folderIndex.entries = folders
folderIndex.builtAt = now
folderIndex.Unlock()
fileIndex.Lock()
fileIndex.entries = files
fileIndex.builtAt = now
fileIndex.Unlock()
folderIndex.buildMu.Unlock()
close(folderIndex.ready)
close(fileIndex.ready)
}()
if *reindexInterval > 0 {