Search: Fixes search limits and adds a page parameter (#16458)
* Search: Fixes search limits and adds a page parameter This adds a page parameter to search api without adding any major breaking change. It does at an api validation error when trying to use a limit beyond 5000. This is a breaking change. We could remove this and have it only in the docs and describe that this is a limit that grafana will apply silently. Fixes #16049 * Fix: Corrected wrong array slice change * Docs: minor docs fix * Search: fixed folder tests * Fixed: Moved limit to correct inner query * Search: moving limit check and page check * Search: limit in handler is no longer needed
This commit is contained in:
@@ -31,6 +31,7 @@ func (s *SearchService) searchHandler(query *Query) error {
|
||||
FolderIds: query.FolderIds,
|
||||
Tags: query.Tags,
|
||||
Limit: query.Limit,
|
||||
Page: query.Page,
|
||||
Permission: query.Permission,
|
||||
}
|
||||
|
||||
@@ -44,10 +45,6 @@ func (s *SearchService) searchHandler(query *Query) error {
|
||||
// sort main result array
|
||||
sort.Sort(hits)
|
||||
|
||||
if len(hits) > query.Limit {
|
||||
hits = hits[0:query.Limit]
|
||||
}
|
||||
|
||||
// sort tags
|
||||
for _, hit := range hits {
|
||||
sort.Strings(hit.Tags)
|
||||
|
||||
@@ -48,7 +48,8 @@ type Query struct {
|
||||
Tags []string
|
||||
OrgId int64
|
||||
SignedInUser *models.SignedInUser
|
||||
Limit int
|
||||
Limit int64
|
||||
Page int64
|
||||
IsStarred bool
|
||||
Type string
|
||||
DashboardIds []int64
|
||||
@@ -67,7 +68,8 @@ type FindPersistedDashboardsQuery struct {
|
||||
Type string
|
||||
FolderIds []int64
|
||||
Tags []string
|
||||
Limit int
|
||||
Limit int64
|
||||
Page int64
|
||||
Permission models.PermissionType
|
||||
|
||||
Result HitList
|
||||
|
||||
Reference in New Issue
Block a user