mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-05 11:51:16 -06:00
Support specifying a search limit
This commit is contained in:
@@ -223,6 +223,9 @@ func (i *Index) Search(ctx context.Context, req *searchsvc.SearchIndexRequest) (
|
||||
)
|
||||
bleveReq := bleve.NewSearchRequest(query)
|
||||
bleveReq.Size = 200
|
||||
if req.PageSize > 0 {
|
||||
bleveReq.Size = int(req.PageSize)
|
||||
}
|
||||
bleveReq.Fields = []string{"*"}
|
||||
res, err := i.bleveIndex.Search(bleveReq)
|
||||
if err != nil {
|
||||
|
||||
@@ -144,6 +144,7 @@ func (p *Provider) Search(ctx context.Context, req *searchsvc.SearchRequest) (*s
|
||||
},
|
||||
Path: mountpointPrefix,
|
||||
},
|
||||
PageSize: req.PageSize,
|
||||
})
|
||||
if err != nil {
|
||||
p.logger.Error().Err(err).Str("space", space.Id.OpaqueId).Msg("failed to search the index")
|
||||
|
||||
@@ -94,7 +94,8 @@ func (s Service) Search(ctx context.Context, in *searchsvc.SearchRequest, out *s
|
||||
ctx = grpcmetadata.AppendToOutgoingContext(ctx, revactx.TokenHeader, t)
|
||||
|
||||
res, err := s.provider.Search(ctx, &searchsvc.SearchRequest{
|
||||
Query: in.Query,
|
||||
Query: in.Query,
|
||||
PageSize: in.PageSize,
|
||||
})
|
||||
if err != nil {
|
||||
switch err.(type) {
|
||||
|
||||
@@ -44,7 +44,8 @@ func (g Webdav) Search(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := revactx.ContextSetToken(r.Context(), t)
|
||||
ctx = metadata.Set(ctx, revactx.TokenHeader, t)
|
||||
rsp, err := g.searchClient.Search(ctx, &searchsvc.SearchRequest{
|
||||
Query: rep.SearchFiles.Search.Pattern,
|
||||
Query: rep.SearchFiles.Search.Pattern,
|
||||
PageSize: int32(rep.SearchFiles.Search.Limit),
|
||||
})
|
||||
if err != nil {
|
||||
e := merrors.Parse(err.Error())
|
||||
|
||||
Reference in New Issue
Block a user