code: func (r *Session) SearchRepositories(term string, limit int) (*registrytypes.SearchResults, error) {
  	if limit < 1 || limit > 100 {
  		return nil, errdefs.InvalidParameter(errors.Errorf("Limit %d is outside the range of [1, 100]", limit))
  	}
  	logrus.Debugf("Index server: %s", r.indexEndpoint)
  	u := r.indexEndpoint.String() + "search?q=" + url.QueryEscape(term) + "&n=" + url.QueryEscape(fmt.Sprintf("%d", limit))
  
  	req, err := http.NewRequest("GET", u, nil)
  	if err != nil {
  		return nil, errors.Wrap(errdefs.InvalidParameter(err), "Error building request")
  	}
  	// Have the AuthTransport send authentication, when logged in.
  	req.Header.Set("X-Docker-Token", "true")
  	res, err := r.client.Do(req)
  	if err != nil {
  		return nil, errdefs.System(err)
  	}
  	defer res.Body.Close()
  	if res.StatusCode != 200 {
  		return nil, newJSONError(fmt.Sprintf("Unexpected status code %d", res.StatusCode), res)
  	}
  	result := new(registrytypes.SearchResults)
  	return result, errors.Wrap(json.NewDecoder(res.Body).Decode(result), "error decoding registry search results")
  }
docs: // SearchRepositories performs a search against the remote repository