def update_schema(self, updates):
    """ Updates the schema of a document.

    Args:
      updates: A list of updates to apply.
    Raises:
      search_exceptions.InternalError on internal errors from SOLR.
    """
    field_list = []
    for update in updates:
      field_list.append({'name': update['name'], 'type': update['type'],
        'stored': 'true', 'indexed': 'true', 'multiValued': 'false'})

    solr_url = "http://{0}:{1}/solr/schema/fields".format(
      self._search_location, self.SOLR_SERVER_PORT)
    json_request = simplejson.dumps(field_list)
    try:
      req = urllib2.Request(solr_url, data=json_request)
      req.add_header('Content-Type', 'application/json')
      conn = urllib2.urlopen(req) 
      if conn.getcode() != HTTP_OK:
        raise search_exceptions.InternalError("Malformed response from SOLR.")
      response = simplejson.load(conn)
      status = response['responseHeader']['status'] 
      logging.debug("Response: {0}".format(response))
    except __HOLE__, exception:
      logging.error("Unable to decode json from SOLR server: {0}".format(
        exception))
      raise search_exceptions.InternalError("Malformed response from SOLR.")

    if status != 0:
      raise search_exceptions.InternalError(
        "SOLR response status of {0}".format(status))
dataset/ETHPy150Open AppScale/appscale/SearchService/solr_interface.py/Solr.update_schema