package bm import ( "git.golem15.com/golem15/summercms/modules/backpack" "git.golem15.com/golem15/summercms/modules/beachcomber" _ "git.golem15.com/golem15/summercms/modules/beachcomber/typesense" "git.golem15.com/jakub/sm-bm-plugin/classes" "git.golem15.com/jakub/sm-bm-plugin/controllers" ) // wireSearch builds the app's beachcomber service (search.driver; the // typesense engine registers itself through the blank import), installs the // jz.bm-only Gate and the material indexer, which the API handlers and the // materials admin hooks use. The Gate is app-wide, so it is on only for // contexts jz.bm marks: golem15.chatchannels' message syncs stay off and // chat messages never reach the index. func (p *Plugin) wireSearch(app *backpack.App) error { svc, err := beachcomber.From(app) if err != nil { return err } svc.SetGate(classes.MaterialSearchGate()) p.materialIndex = classes.NewMaterialIndexer(app) controllers.UseMaterialIndex(p.materialIndex) return nil }