diff --git a/pkg/registry/apis/dashboard/search.go b/pkg/registry/apis/dashboard/search.go index 4818b9971cd..22a9c840f5f 100644 --- a/pkg/registry/apis/dashboard/search.go +++ b/pkg/registry/apis/dashboard/search.go @@ -192,6 +192,8 @@ func (s *SearchHandler) DoSortable(w http.ResponseWriter, r *http.Request) { s.write(w, sortable) } +const rootFolder = "general" + func (s *SearchHandler) DoSearch(w http.ResponseWriter, r *http.Request) { ctx, span := s.tracer.Start(r.Context(), "dashboard.search") defer span.End() @@ -234,6 +236,9 @@ func (s *SearchHandler) DoSearch(w http.ResponseWriter, r *http.Request) { // Add the folder constraint. Note this does not do recursive search folder := queryParams.Get("folder") if folder != "" { + if folder == rootFolder { + folder = "" // root folder is empty in the search index + } searchRequest.Options.Fields = []*resource.Requirement{{ Key: "folder", Operator: "=", diff --git a/public/app/features/search/service/unified.ts b/public/app/features/search/service/unified.ts index 04f4be200c5..65e8bbf82f5 100644 --- a/public/app/features/search/service/unified.ts +++ b/public/app/features/search/service/unified.ts @@ -58,12 +58,6 @@ export class UnifiedSearcher implements GrafanaSearcher { if (query.facet?.length) { throw new Error('facets not supported!'); } - - if (query.kind?.length === 1 && query.kind[0] === 'dashboard') { - // TODO: this is browse mode, so skip the search - return noDataResponse(); - } - return this.doSearchQuery(query); }