From 07601bee6f0a8bcb536880361a1a18559639feb0 Mon Sep 17 00:00:00 2001 From: Scott Lepper Date: Wed, 29 Jan 2025 11:48:19 -0500 Subject: [PATCH] [search] title search wildcard (#99769) --- pkg/services/dashboards/service/dashboard_service.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/pkg/services/dashboards/service/dashboard_service.go b/pkg/services/dashboards/service/dashboard_service.go index d56118429d2..bc193b82b18 100644 --- a/pkg/services/dashboards/service/dashboard_service.go +++ b/pkg/services/dashboards/service/dashboard_service.go @@ -1699,17 +1699,9 @@ func (dr *DashboardServiceImpl) searchDashboardsThroughK8sRaw(ctx context.Contex request.Options.Fields = append(request.Options.Fields, req...) } - // note: this does not allow for partial matching - // - // partial matching will be allowed through the api layer for the frontend, - // but is currently not needed by other services in the backend if query.Title != "" { - req := []*resource.Requirement{{ - Key: resource.SEARCH_FIELD_TITLE_SORT, // use title sort to prevent issues with `-` in the title & how bleve searches - Operator: string(selection.In), - Values: []string{strings.ToLower(query.Title)}, - }} - request.Options.Fields = append(request.Options.Fields, req...) + // allow wildcard search + request.Query = "*" + strings.ToLower(query.Title) + "*" } if len(query.Tags) > 0 {