[release-12.0.5] search: Force index IDX_dashboard_title when searching dashboards (#111418)
search: Force index IDX_dashboard_title when searching dashboards (#110595)
(cherry picked from commit 726c7ba71b)
Signed-off-by: Maicon Costa <maiconscosta@gmail.com>
Co-authored-by: maicon <maiconscosta@gmail.com>
This commit is contained in:
co-authored by
maicon
parent
da3717b315
commit
31c4188746
@@ -149,7 +149,12 @@ func (b *Builder) applyFilters() (ordering string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
b.sql.WriteString("SELECT dashboard.id FROM dashboard")
|
forceIndex := ""
|
||||||
|
if b.Dialect.DriverName() == migrator.MySQL {
|
||||||
|
forceIndex = " FORCE INDEX (IDX_dashboard_title) "
|
||||||
|
}
|
||||||
|
|
||||||
|
b.sql.WriteString(fmt.Sprintf("SELECT dashboard.id FROM dashboard %s", forceIndex))
|
||||||
b.sql.WriteString(strings.Join(joins, ""))
|
b.sql.WriteString(strings.Join(joins, ""))
|
||||||
|
|
||||||
if len(wheres) > 0 {
|
if len(wheres) > 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user