code: func (c *SearchController) Spaces(ctx *app.SpacesSearchContext) error {
  	q := ctx.Q
  	if q == "" {
  		return jsonapi.JSONErrorResponse(ctx, goa.ErrBadRequest("empty search query not allowed"))
  	} else if q == "*" {
  		q = "" // Allow empty query if * specified
  	}
  
  	var result []space.Space
  	var count int
  	var err error
  	offset, limit := computePagingLimits(ctx.PageOffset, ctx.PageLimit)
  	err = application.Transactional(c.db, func(appl application.Application) error {
  		result, count, err = appl.Spaces().Search(ctx, &q, &offset, &limit)
  		if err != nil {
  			log.Error(ctx, map[string]interface{}{
  				"query":  q,
  				"offset": offset,
  				"limit":  limit,
  				"err":    err,
  			}, "unable to list spaces")
  		}
  		return err
  	})
  	if err != nil {
  		return jsonapi.JSONErrorResponse(ctx, err)
  	}
  	spaceData, err := ConvertSpacesFromModel(ctx.Request, result, IncludeBacklogTotalCount(ctx.Context, c.db))
  	if err != nil {
  		return jsonapi.JSONErrorResponse(ctx, err)
  	}
  	response := app.SearchSpaceList{
  		Links: &app.PagingLinks{},
  		Meta:  &app.SpaceListMeta{TotalCount: count},
  		Data:  spaceData,
  	}
  	setPagingLinks(response.Links, buildAbsoluteURL(ctx.Request), len(result), offset, limit, count, "q="+q)
  	return ctx.OK(&response)
  }
docs: // Spaces runs the space search action.