[full-ci] experimental search backport (#5221)
* experimental search backport fix basic extractor resource name move escapeQuery regex into global variable minor pr review changes rename DebounceDuration env variable add document title and content when rebuilding bleve resource Co-authored-by: David Christofas <dchristofas@owncloud.com>
This commit is contained in:
co-authored by
David Christofas
parent
2fa1a3afbe
commit
2404eff48e
@@ -6,7 +6,7 @@ import (
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/log"
|
||||
"github.com/owncloud/ocis/v2/services/search/pkg/config"
|
||||
"github.com/owncloud/ocis/v2/services/search/pkg/metrics"
|
||||
svc "github.com/owncloud/ocis/v2/services/search/pkg/service/v0"
|
||||
svc "github.com/owncloud/ocis/v2/services/search/pkg/service/grpc/v0"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@ import (
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/service/grpc"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/version"
|
||||
searchsvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/search/v0"
|
||||
svc "github.com/owncloud/ocis/v2/services/search/pkg/service/v0"
|
||||
svc "github.com/owncloud/ocis/v2/services/search/pkg/service/grpc/v0"
|
||||
)
|
||||
|
||||
// Server initializes a new go-micro service ready to run
|
||||
func Server(opts ...Option) grpc.Service {
|
||||
func Server(opts ...Option) (grpc.Service, func(), error) {
|
||||
options := newOptions(opts...)
|
||||
|
||||
service, err := grpc.NewService(
|
||||
@@ -27,10 +27,10 @@ func Server(opts ...Option) grpc.Service {
|
||||
)
|
||||
if err != nil {
|
||||
options.Logger.Fatal().Err(err).Msg("Error creating search service")
|
||||
return grpc.Service{}
|
||||
return grpc.Service{}, func() {}, err
|
||||
}
|
||||
|
||||
handle, err := svc.NewHandler(
|
||||
handle, teardown, err := svc.NewHandler(
|
||||
svc.Config(options.Config),
|
||||
svc.Logger(options.Logger),
|
||||
)
|
||||
@@ -38,11 +38,18 @@ func Server(opts ...Option) grpc.Service {
|
||||
options.Logger.Error().
|
||||
Err(err).
|
||||
Msg("Error initializing search service")
|
||||
return grpc.Service{}
|
||||
return grpc.Service{}, teardown, err
|
||||
}
|
||||
_ = searchsvc.RegisterSearchProviderHandler(
|
||||
|
||||
if err := searchsvc.RegisterSearchProviderHandler(
|
||||
service.Server(),
|
||||
handle,
|
||||
)
|
||||
return service
|
||||
); err != nil {
|
||||
options.Logger.Error().
|
||||
Err(err).
|
||||
Msg("Error registering search provider handler")
|
||||
return grpc.Service{}, teardown, err
|
||||
}
|
||||
|
||||
return service, teardown, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user