code: func (hs *HTTPServer) SearchTeams(c *m.ReqContext) Response {
  	perPage := c.QueryInt("perpage")
  	if perPage <= 0 {
  		perPage = 1000
  	}
  	page := c.QueryInt("page")
  	if page < 1 {
  		page = 1
  	}
  
  	var userIdFilter int64
  	if hs.Cfg.EditorsCanAdmin && c.OrgRole != m.ROLE_ADMIN {
  		userIdFilter = c.SignedInUser.UserId
  	}
  
  	query := m.SearchTeamsQuery{
  		OrgId:        c.OrgId,
  		Query:        c.Query("query"),
  		Name:         c.Query("name"),
  		UserIdFilter: userIdFilter,
  		Page:         page,
  		Limit:        perPage,
  	}
  
  	if err := bus.Dispatch(&query); err != nil {
  		return Error(500, "Failed to search Teams", err)
  	}
  
  	for _, team := range query.Result.Teams {
  		team.AvatarUrl = dtos.GetGravatarUrlWithDefault(team.Email, team.Name)
  	}
  
  	query.Result.Page = page
  	query.Result.PerPage = perPage
  
  	return JSON(200, query.Result)
  }
docs: // GET /api/teams/search