diff options
author | Steve Manuel <nilslice@gmail.com> | 2017-06-10 16:53:21 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-10 16:53:21 -0600 |
commit | ccfbb7cb00113bf9b9c7e7ac5742df72cd5b96fd (patch) | |
tree | 553fcdb6ff4bb318879cf2418962b0927d5fb519 /system/db/init.go | |
parent | 38aa0ebb1df97ff185d84da2d3c2f9a11888729b (diff) | |
parent | ea998eb195063617aa485ce99b0e5bd1697ecab5 (diff) |
Merge pull request #157 from guycalledseven/ponzu-dev
Fix for search not working when addons are enabled
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 |