func init() { cbgt.RegisterPIndexImplType("fulltext-index", &cbgt.PIndexImplType{ Validate: ValidateBlevePIndexImpl, New: NewBlevePIndexImpl, Open: OpenBlevePIndexImpl, Count: CountBlevePIndexImpl, Query: QueryBlevePIndexImpl, Description: "general/fulltext-index " + " - a full text index powered by the bleve engine", StartSample: NewBleveParams(), QuerySamples: BlevePIndexQuerySamples, QueryHelp: bleveQueryHelp, InitRouter: BlevePIndexImplInitRouter, DiagHandlers: []cbgt.DiagHandler{ {"/api/pindex-bleve", bleveHttp.NewListIndexesHandler(), nil}, }, MetaExtra: BleveMetaExtra, UI: map[string]string{ "controllerInitName": "blevePIndexInitController", "controllerDoneName": "blevePIndexDoneController", }, }) }
func init() { // Register alias with empty instantiation functions, // so that "alias" will show up in valid index types. cbgt.RegisterPIndexImplType("alias", &cbgt.PIndexImplType{ Validate: ValidateAlias, Count: CountAlias, Query: QueryAlias, Description: "advanced/alias" + " - an alias provides a naming level of indirection" + " to one or more actual, target indexes", StartSample: &AliasParams{ Targets: map[string]*AliasParamsTarget{ "yourIndexName": &AliasParamsTarget{}, }, }, }) }
func (sc *ServerContext) registerCbgtPindexType() error { // The Description format is: // // $categoryName/$indexType - short descriptive string // // where $categoryName is something like "advanced", or "general". description := fmt.Sprintf("%v/%v - Sync Gateway", base.IndexCategorySyncGateway, base.IndexTypeSyncGateway) // Register with CBGT cbgt.RegisterPIndexImplType(base.IndexTypeSyncGateway, &cbgt.PIndexImplType{ New: sc.NewSyncGatewayPIndexFactory, Open: sc.OpenSyncGatewayPIndexFactory, Count: nil, Query: nil, Description: description, }) return nil }
// The user may have informed the cmd about application specific index // types, which we need to register (albeit with fake, "error-only" // implementations) because the cbgt's planner (cbgt.CalcPlan()) has // safety checks which skips any unknown, unregistered index types. func RegisterIndexTypes(indexTypes []string) { newErrorPIndexImpl := func(indexType, indexParams, path string, restart func()) (cbgt.PIndexImpl, cbgt.Dest, error) { return nil, nil, fmt.Errorf("ErrorPIndex-NEW") } openErrorPIndexImpl := func(indexType, path string, restart func()) ( cbgt.PIndexImpl, cbgt.Dest, error) { return nil, nil, fmt.Errorf("ErrorPIndex-OPEN") } for _, indexType := range indexTypes { if cbgt.PIndexImplTypes[indexType] == nil { cbgt.RegisterPIndexImplType(indexType, &cbgt.PIndexImplType{ New: newErrorPIndexImpl, Open: openErrorPIndexImpl, }) } } }
func init() { cbgt.RegisterPIndexImplType("bleve", &cbgt.PIndexImplType{ Validate: ValidateBlevePIndexImpl, New: NewBlevePIndexImpl, Open: OpenBlevePIndexImpl, Count: CountBlevePIndexImpl, Query: QueryBlevePIndexImpl, Description: "general/full-text (bleve)" + " - a full-text index powered by the bleve engine", StartSample: NewBleveParams(), QuerySamples: BlevePIndexQuerySamples, QueryHelp: bleveQueryHelp, InitRouter: BlevePIndexImplInitRouter, DiagHandlers: []cbgt.DiagHandler{ {"/api/pindex-bleve", bleveHttp.NewListIndexesHandler(), nil}, }, MetaExtra: BleveMetaExtra, }) }