fix(postgres): Dashboard search is now case insensitive when using Postgres, fixes #1896

This commit is contained in:
Torkel Ödegaard
2015-08-10 20:25:01 +02:00
parent 4f3a3329e2
commit 835fd383ad
4 changed files with 11 additions and 1 deletions
+1 -1
View File
@@ -146,7 +146,7 @@ func SearchDashboards(query *search.FindPersistedDashboardsQuery) error {
}
if len(query.Title) > 0 {
sql.WriteString(" AND dashboard.title LIKE ?")
sql.WriteString(" AND dashboard.title " + dialect.LikeStr() + " ?")
params = append(params, "%"+query.Title+"%")
}
@@ -16,6 +16,7 @@ type Dialect interface {
ShowCreateNull() bool
SqlType(col *Column) string
SupportEngine() bool
LikeStr() string
CreateIndexSql(tableName string, index *Index) string
CreateTableSql(table *Table) string
@@ -58,6 +59,10 @@ func (b *BaseDialect) AndStr() string {
return "AND"
}
func (b *BaseDialect) LikeStr() string {
return "LIKE"
}
func (b *BaseDialect) OrStr() string {
return "OR"
}
@@ -28,6 +28,10 @@ func (db *Postgres) QuoteStr() string {
return "\""
}
func (b *Postgres) LikeStr() string {
return "ILIKE"
}
func (db *Postgres) AutoIncrStr() string {
return ""
}