You are here

protected function DrupalApacheSolrService::_constructUrl in Apache Solr Search 6.3

Same name and namespace in other branches
  1. 8 Drupal_Apache_Solr_Service.php \DrupalApacheSolrService::_constructUrl()
  2. 7 Drupal_Apache_Solr_Service.php \DrupalApacheSolrService::_constructUrl()

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

Parameters

$servlet: A string path to a Solr request handler.

$params:

$parsed_url: A url to use instead of the stored one.

Return value

string

8 calls to DrupalApacheSolrService::_constructUrl()
DrupalApacheSolrService::getUrl in ./Drupal_Apache_Solr_Service.php
Get the Solr url
DrupalApacheSolrService::makeServletRequest in ./Drupal_Apache_Solr_Service.php
Make a request to a servlet (a path) that's not a standard path.
DrupalApacheSolrService::ping in ./Drupal_Apache_Solr_Service.php
Call the /admin/ping servlet, to test the connection to the server.
DrupalApacheSolrService::search in ./Drupal_Apache_Solr_Service.php
Simple Search interface
DrupalApacheSolrService::setLuke in ./Drupal_Apache_Solr_Service.php
Sets $this->luke with the meta-data about the index from admin/luke.

... See full list

File

./Drupal_Apache_Solr_Service.php, line 588

Class

DrupalApacheSolrService
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(), $added_query_string = NULL) {

  // PHP's built in http_build_query() doesn't give us the format Solr wants.
  $query_string = $this
    ->httpBuildQuery($params);
  if ($query_string) {
    $query_string = '?' . $query_string;
    if ($added_query_string) {
      $query_string = $query_string . '&' . $added_query_string;
    }
  }
  elseif ($added_query_string) {
    $query_string = '?' . $added_query_string;
  }
  $url = $this->parsed_url;
  return $url['scheme'] . $url['user'] . $url['pass'] . $url['host'] . $url['port'] . $url['path'] . $servlet . $query_string;
}