You are here

protected function Apache_Solr_Service::_constructUrl in Apache Solr Search 5

Return a valid http URL given this server's host, port and path and a provided servlet name

Parameters

string $servlet:

Return value

string

1 call to Apache_Solr_Service::_constructUrl()
Apache_Solr_Service::_initUrls in SolrPhpClient/Apache/Solr/Service.php
Construct the Full URLs for the three servlets we reference

File

SolrPhpClient/Apache/Solr/Service.php, line 225

Class

Apache_Solr_Service
Starting point for the Solr API. Represents a Solr server resource and has methods for pinging, adding, deleting, committing, optimizing and searching.

Code

protected function _constructUrl($servlet, $params = array()) {
  if (count($params)) {

    //escape all parameters appropriately for inclusion in the query string
    $escapedParams = array();
    foreach ($params as $key => $value) {
      $escapedParams[] = urlencode($key) . '=' . urlencode($value);
    }
    $queryString = $this->_queryDelimiter . implode($this->_queryStringDelimiter, $escapedParams);
  }
  else {
    $queryString = '';
  }
  return 'http://' . $this->_host . ':' . $this->_port . $this->_path . $servlet . $queryString;
}