search: fix search to limit dashboards better

Change the query to first select the dashboards, apply the limit then
join with tags. Means the limit will apply to the number of dashboards
returned in the search. The disadvantage is that the query will return
more rows than the limit, no. of dashboards x no. of tags. So hard limit
set to 5000 for all rows.
This commit is contained in:
Daniel Lee
2017-10-10 20:56:05 +02:00
parent 647a3cc5ae
commit cd6a18ec62
3 changed files with 65 additions and 38 deletions
+3 -2
View File
@@ -11,11 +11,10 @@ import (
"github.com/grafana/grafana/pkg/services/sqlstore/sqlutil"
)
func InitTestDB(t *testing.T) {
func InitTestDB(t *testing.T) *xorm.Engine {
x, err := xorm.NewEngine(sqlutil.TestDB_Sqlite3.DriverName, sqlutil.TestDB_Sqlite3.ConnStr)
//x, err := xorm.NewEngine(sqlutil.TestDB_Mysql.DriverName, sqlutil.TestDB_Mysql.ConnStr)
//x, err := xorm.NewEngine(sqlutil.TestDB_Postgres.DriverName, sqlutil.TestDB_Postgres.ConnStr)
// x.ShowSQL()
// x.ShowSQL()
@@ -28,6 +27,8 @@ func InitTestDB(t *testing.T) {
if err := SetEngine(x); err != nil {
t.Fatal(err)
}
return x
}
type Test struct {