def __execute_query(self, solr_query):
    """ Executes query string on SOLR. 

    Args:
      solr_query: A str, the query to run.
    Returns:
      The results from the query executing.
    Raises:
      search_exceptions.InternalError on internal SOLR error.
    """
    solr_url = "http://{0}:{1}/solr/select/?wt=json&{2}"\
      .format(self._search_location, self.SOLR_SERVER_PORT,
      solr_query)
    logging.debug("SOLR URL: {0}".format(solr_url))
    try:
      req = urllib2.Request(solr_url)
      req.add_header('Content-Type', 'application/json')
      conn = urllib2.urlopen(req) 
      if conn.getcode() != HTTP_OK:
        logging.error("Got code {0} with URL {1}.".format(
          conn.getcode(), solr_url))
        raise search_exceptions.InternalError("Bad request sent to 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.")
    except urllib2.HTTPError, http_error:
      logging.exception(http_error)
      # We assume no results were returned.
      status = 0
      response = {'response': {'docs': [], 'start': 0}}

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