You are here

public function SolrConnectorPluginBase::getFile in Search API Solr 4.x

Same name and namespace in other branches
  1. 8.3 src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::getFile()
  2. 8 src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::getFile()
  3. 8.2 src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::getFile()

Retrieves a config file or file list from the Solr server.

Uses the admin/file request handler.

Parameters

string|null $file: (optional) The name of the file to retrieve. If the file is a directory, the directory contents are instead listed and returned. NULL represents the root config directory.

Return value

\Solarium\Core\Client\Response A Solarium response object containing either the file contents or a file list.

Throws

\Drupal\search_api_solr\SearchApiSolrException

Overrides SolrConnectorInterface::getFile

File

src/SolrConnector/SolrConnectorPluginBase.php, line 1204

Class

SolrConnectorPluginBase
Defines a base class for Solr connector plugins.

Namespace

Drupal\search_api_solr\SolrConnector

Code

public function getFile($file = NULL) {
  $this
    ->connect();
  $query = $this->solr
    ->createApi([
    'handler' => $this->configuration['core'] . '/admin/file',
  ]);
  if ($file) {
    $query
      ->addParam('file', $file);
  }
  return $this
    ->execute($query)
    ->getResponse();
}