summaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorNeven Jacmenović <neven@nivas.hr>2017-06-11 23:41:03 +0200
committerNeven Jacmenović <neven@nivas.hr>2017-06-11 23:41:03 +0200
commitce7dc44721241b669ae7b5ba6c401dc528248cf4 (patch)
treedfce4159465b6dd4b86c714edfd59a11555a2a5e /system
parente3fb3aba33645ef1c7ba1d1556c806d7c0eb853b (diff)
delayed indexer init (fix for search not working when addons are enabled)
Diffstat (limited to 'system')
-rw-r--r--system/db/init.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/system/db/init.go b/system/db/init.go
index a401a2a..173ca6f 100644
--- a/system/db/init.go
+++ b/system/db/init.go
@@ -98,6 +98,22 @@ func Init() {
}()
}
+// InitSearchIndex initializes Search Index for search to be functional
+// This was moved out of db.Init and put to main(), because addoon 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
// would indicate that the system has been configured to the minimum required.
func SystemInitComplete() bool {