mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fixed case insensitive search for file based dashboards, Fixes #2258
This commit is contained in:
@@ -51,13 +51,15 @@ func (index *JsonDashIndex) Search(query *Query) ([]*Hit, error) {
|
|||||||
return results, nil
|
return results, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
queryStr := strings.ToLower(query.Title)
|
||||||
|
|
||||||
for _, item := range index.items {
|
for _, item := range index.items {
|
||||||
if len(results) > query.Limit {
|
if len(results) > query.Limit {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
// add results with matchig title filter
|
// add results with matchig title filter
|
||||||
if strings.Contains(item.TitleLower, query.Title) {
|
if strings.Contains(item.TitleLower, queryStr) {
|
||||||
results = append(results, &Hit{
|
results = append(results, &Hit{
|
||||||
Type: DashHitJson,
|
Type: DashHitJson,
|
||||||
Title: item.Dashboard.Title,
|
Title: item.Dashboard.Title,
|
||||||
|
|||||||
Reference in New Issue
Block a user