Skip to content

Commit

Permalink
[search] title search wildcard (grafana#99769)
Browse files Browse the repository at this point in the history
  • Loading branch information
scottlepp authored Jan 29, 2025
1 parent be9a7ce commit 07601be
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions pkg/services/dashboards/service/dashboard_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 07601be

Please sign in to comment.