diff options
Diffstat (limited to 'system/db/init.go')
-rw-r--r-- | system/db/init.go | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/system/db/init.go b/system/db/init.go index a401a2a..ad0011f 100644 --- a/system/db/init.go +++ b/system/db/init.go @@ -85,17 +85,22 @@ func Init() { log.Fatalln("Failed to invalidate cache.", err) } - go func() { - for t := range item.Types { - err := search.MapIndex(t) - if err != nil { - log.Fatalln(err) - return - } +} - SortContent(t) +// InitSearchIndex initializes Search Index for search to be functional +// This was moved out of db.Init and put to main(), because addon checker was initializing db together with +// search indexing initialisation in time when there were no item.Types defined so search index was always +// empty when using addons. We still have no guarentee whatsoever that item.Types is defined +// Should be called from a goroutine after SetContent is successful (SortContent requirement) +func InitSearchIndex() { + for t := range item.Types { + err := search.MapIndex(t) + if err != nil { + log.Fatalln(err) + return } - }() + SortContent(t) + } } // SystemInitComplete checks if there is at least 1 admin user in the db which |