Skip to content

Commit

Permalink
Merge pull request #158 from ponzu-cms/revert-157-ponzu-dev
Browse files Browse the repository at this point in the history
Revert "Fix for search not working when addons are enabled"
  • Loading branch information
nilslice authored Jun 10, 2017
2 parents ccfbb7c + 9361ebe commit 427dff5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
2 changes: 0 additions & 2 deletions cmd/ponzu/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
23 changes: 9 additions & 14 deletions system/db/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 427dff5

Please sign in to comment.