diff options
author | Steve Manuel <nilslice@gmail.com> | 2017-06-10 15:53:39 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-10 15:53:39 -0700 |
commit | 9361ebeb84297c02cfa3d9a3b784893b4e9f405e (patch) | |
tree | 72a8557eb7e717b930d2a3ff304a77f4ddff437d | |
parent | ccfbb7cb00113bf9b9c7e7ac5742df72cd5b96fd (diff) |
Revert "Fix for search not working when addons are enabled"
-rw-r--r-- | cmd/ponzu/main.go | 2 | ||||
-rw-r--r-- | system/db/init.go | 23 |
2 files changed, 9 insertions, 16 deletions
diff --git a/cmd/ponzu/main.go b/cmd/ponzu/main.go index c102aa4..7572dcc 100644 --- a/cmd/ponzu/main.go +++ b/cmd/ponzu/main.go @@ -137,8 +137,6 @@ var serveCmd = &cobra.Command{ } } - go db.InitSearchIndex() - // save the https port the system is listening on err := db.PutConfig("https_port", fmt.Sprintf("%d", httpsport)) if err != nil { diff --git a/system/db/init.go b/system/db/init.go index ad0011f..a401a2a 100644 --- a/system/db/init.go +++ b/system/db/init.go @@ -85,22 +85,17 @@ 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 + } -// 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) } - SortContent(t) - } + }() } // SystemInitComplete checks if there is at least 1 admin user in the db which |