Improve search result page
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user