You are here

interface SolrConnectorInterface in Search API Solr 8.3

Same name and namespace in other branches
  1. 8 src/SolrConnectorInterface.php \Drupal\search_api_solr\SolrConnectorInterface
  2. 8.2 src/SolrConnectorInterface.php \Drupal\search_api_solr\SolrConnectorInterface
  3. 4.x src/SolrConnectorInterface.php \Drupal\search_api_solr\SolrConnectorInterface

The Solr connector interface.

Hierarchy

Expanded class hierarchy of SolrConnectorInterface

All classes that implement SolrConnectorInterface

2 files declare their use of SolrConnectorInterface
SearchApiSolrBackend.php in src/Plugin/search_api/backend/SearchApiSolrBackend.php
SolrConnectorPluginBase.php in src/SolrConnector/SolrConnectorPluginBase.php

File

src/SolrConnectorInterface.php, line 17

Namespace

Drupal\search_api_solr
View source
interface SolrConnectorInterface extends ConfigurableInterface {
  const QUERY_TIMEOUT = 'query_timeout';
  const INDEX_TIMEOUT = 'index_timeout';
  const OPTIMIZE_TIMEOUT = 'optimize_timeout';
  const FINALIZE_TIMEOUT = 'finalize_timeout';

  /**
   * Returns TRUE for Cloud.
   *
   * @return bool
   *   Whether this is a Solr Cloud connector.
   */
  public function isCloud();

  /**
   * Returns a link to the Solr server.
   *
   * @return \Drupal\Core\Link
   *   The link object to the Solr server.
   */
  public function getServerLink();

  /**
   * Returns a link to the Solr core, if the necessary options are set.
   *
   * @return \Drupal\Core\Link
   *   The link object to the Solr core.
   */
  public function getCoreLink();

  /**
   * Gets the current Solr version.
   *
   * @param bool $force_auto_detect
   *   If TRUE, ignore user overwrites.
   *
   * @return string
   *   The full Solr version string.
   */
  public function getSolrVersion($force_auto_detect = FALSE);

  /**
   * Gets the current Solr major version.
   *
   * @param string $version
   *   An optional Solr version string.
   *
   * @return int
   *   The Solr major version.
   */
  public function getSolrMajorVersion($version = '') : int;

  /**
   * Gets the current Solr branch name.
   *
   * @param string $version
   *   An optional Solr version string.
   *
   * @return string
   *   The Solr branch string.
   */
  public function getSolrBranch($version = '');

  /**
   * Gets the LuceneMatchVersion string.
   *
   * @param string $version
   *   An optional Solr version string.
   *
   * @return string
   *   The lucene match version in V.V format.
   */
  public function getLuceneMatchVersion($version = '');

  /**
   * Gets information about the Solr server.
   *
   * @param bool $reset
   *   If TRUE the server will be asked regardless if a previous call is cached.
   *
   * @return object
   *   A response object with server information.
   *
   * @throws \Drupal\search_api_solr\SearchApiSolrException
   */
  public function getServerInfo($reset = FALSE);

  /**
   * Gets information about the Solr Core.
   *
   * @param bool $reset
   *   If TRUE the server will be asked regardless if a previous call is cached.
   *
   * @return object
   *   A response object with system information.
   *
   * @throws \Drupal\search_api_solr\SearchApiSolrException
   */
  public function getCoreInfo($reset = FALSE);

  /**
   * Gets meta-data about the index.
   *
   * @return object
   *   A response object filled with data from Solr's Luke.
   *
   * @throws \Drupal\search_api_solr\SearchApiSolrException
   */
  public function getLuke();

  /**
   * Gets the full schema version string the core is using.
   *
   * @param bool $reset
   *   If TRUE the server will be asked regardless if a previous call is cached.
   *
   * @return string
   *   The full schema version string.
   *
   * @throws \Drupal\search_api_solr\SearchApiSolrException
   */
  public function getSchemaVersionString($reset = FALSE);

  /**
   * Gets the schema version number.
   *
   * @param bool $reset
   *   If TRUE the server will be asked regardless if a previous call is cached.
   *
   * @return string
   *   The schema version number.
   *
   * @throws \Drupal\search_api_solr\SearchApiSolrException
   */
  public function getSchemaVersion($reset = FALSE);

  /**
   * Pings the Solr core to tell whether it can be accessed.
   *
   * @param array $options
   *   (optional) An array of options.
   *
   * @return mixed
   *   The latency in milliseconds if the core can be accessed,
   *   otherwise FALSE.
   */
  public function pingCore(array $options = []);

  /**
   * Pings the Solr server to tell whether it can be accessed.
   *
   * @return mixed
   *   The latency in milliseconds if the core can be accessed,
   *   otherwise FALSE.
   *
   * @throws \Drupal\search_api_solr\SearchApiSolrException
   */
  public function pingServer();

  /**
   * Gets summary information about the Solr Core.
   *
   * @return array
   *   An array of stats about the solr core.
   *
   * @throws \Drupal\search_api_solr\SearchApiSolrException
   */
  public function getStatsSummary();

  /**
   * Sends a REST GET request to the Solr core and returns the result.
   *
   * @param string $path
   *   The path to append to the base URI.
   *
   * @return string
   *   The decoded response.
   *
   * @throws \Drupal\search_api_solr\SearchApiSolrException
   */
  public function coreRestGet($path);

  /**
   * Sends a REST POST request to the Solr core and returns the result.
   *
   * @param string $path
   *   The path to append to the base URI.
   * @param string $command_json
   *   The command to send encoded as JSON.
   *
   * @return string
   *   The decoded response.
   *
   * @throws \Drupal\search_api_solr\SearchApiSolrException
   */
  public function coreRestPost($path, $command_json = '');

  /**
   * Sends a REST GET request to the Solr server and returns the result.
   *
   * @param string $path
   *   The path to append to the base URI.
   *
   * @return string
   *   The decoded response.
   *
   * @throws \Drupal\search_api_solr\SearchApiSolrException
   */
  public function serverRestGet($path);

  /**
   * Sends a REST POST request to the Solr server and returns the result.
   *
   * @param string $path
   *   The path to append to the base URI.
   * @param string $command_json
   *   The command to send encoded as JSON.
   *
   * @return string
   *   The decoded response.
   *
   * @throws \Drupal\search_api_solr\SearchApiSolrException
   */
  public function serverRestPost($path, $command_json = '');

  /**
   * Creates a new Solarium update query.
   *
   * @return \Solarium\QueryType\Update\Query\Query
   *   The Update query.
   */
  public function getUpdateQuery();

  /**
   * Creates a new Solarium update query.
   *
   * @return \Solarium\QueryType\Select\Query\Query
   *   The Select query.
   */
  public function getSelectQuery();

  /**
   * Creates a new Solarium more like this query.
   *
   * @return \Solarium\QueryType\MorelikeThis\Query
   *   The MoreLikeThis query.
   */
  public function getMoreLikeThisQuery();

  /**
   * Creates a new Solarium terms query.
   *
   * @return \Solarium\QueryType\Terms\Query
   *   The Terms query.
   */
  public function getTermsQuery();

  /**
   * Creates a new Solarium suggester query.
   *
   * @return \Solarium\QueryType\Spellcheck\Query
   *   The Spellcheck query.
   */
  public function getSpellcheckQuery();

  /**
   * Creates a new Solarium suggester query.
   *
   * @return \Solarium\QueryType\Suggester\Query
   *   The Suggester query.
   */
  public function getSuggesterQuery();

  /**
   * Creates a new Solarium autocomplete query.
   *
   * @return \Drupal\search_api_solr\Solarium\Autocomplete\Query
   *   The Autocomplete query.
   */
  public function getAutocompleteQuery();

  /**
   * Creates a new Solarium extract query.
   *
   * @return \Solarium\QueryType\Extract\Query
   *   The Extract query.
   */
  public function getExtractQuery();

  /**
   * Returns a Solarium query helper object.
   *
   * @param \Solarium\Core\Query\QueryInterface|null $query
   *   (optional) A Solarium query object.
   *
   * @return \Solarium\Core\Query\Helper
   *   A Solarium query helper.
   */
  public function getQueryHelper(QueryInterface $query = NULL);

  /**
   * Executes a search query and returns the raw response.
   *
   * @param \Solarium\QueryType\Select\Query\Query $query
   *   The Solarium select query object.
   * @param \Solarium\Core\Client\Endpoint|null $endpoint
   *   (optional) The Solarium endpoint object.
   *
   * @return \Solarium\Core\Client\Response
   *   The Solarium response object.
   *
   * @throws \Drupal\search_api_solr\SearchApiSolrException
   */
  public function search(Query $query, ?Endpoint $endpoint = NULL);

  /**
   * Creates a result from a response.
   *
   * @param \Solarium\Core\ConfigurableInterface|QueryInterface $query
   *   The Solarium query object.
   * @param \Solarium\Core\Client\Response $response
   *   The Solarium response object.
   *
   * @return \Solarium\Core\Query\Result\ResultInterface
   *   The Solarium result object.
   */
  public function createSearchResult(QueryInterface $query, Response $response);

  /**
   * Executes an update query and applies some tweaks.
   *
   * @param \Solarium\QueryType\Update\Query\Query $query
   *   The Solarium update query object.
   * @param \Solarium\Core\Client\Endpoint|null $endpoint
   *   (optional) The Solarium endpoint object.
   *
   * @return \Solarium\Core\Query\Result\ResultInterface
   *   The Solarium result object.
   *
   * @throws \Drupal\search_api_solr\SearchApiSolrException
   */
  public function update(UpdateQuery $query, ?Endpoint $endpoint = NULL);

  /**
   * Executes any query.
   *
   * @param \Solarium\Core\Query\QueryInterface $query
   *   The Solarium query object.
   * @param \Solarium\Core\Client\Endpoint|null $endpoint
   *   (optional) The Solarium endpoint object.
   *
   * @return \Solarium\Core\Query\Result\ResultInterface
   *   The Solarium result object.
   *
   * @throws \Drupal\search_api_solr\SearchApiSolrException
   */
  public function execute(QueryInterface $query, ?Endpoint $endpoint = NULL);

  /**
   * Executes a request and returns the response.
   *
   * @param \Solarium\Core\Client\Request $request
   *   The Solarium request object.
   * @param \Solarium\Core\Client\Endpoint|null $endpoint
   *   (optional) The Solarium endpoint object.
   *
   * @return \Solarium\Core\Client\Response
   *   The Solarium response object.
   *
   * @throws \Drupal\search_api_solr\SearchApiSolrException
   */
  public function executeRequest(Request $request, ?Endpoint $endpoint = NULL);

  /**
   * Optimizes the Solr index.
   *
   * @param \Solarium\Core\Client\Endpoint|null $endpoint
   *   (optional) The Solarium endpoint object.
   *
   * @throws \Drupal\search_api_solr\SearchApiSolrException
   */
  public function optimize(?Endpoint $endpoint = NULL);

  /**
   * Executes an extract query.
   *
   * @param \Solarium\Core\Query\QueryInterface|\Solarium\QueryType\Extract\Query $query
   *   The Solarium extract query object.
   * @param \Solarium\Core\Client\Endpoint|null $endpoint
   *   (optional) The Solarium endpoint object.
   *
   * @return \Solarium\QueryType\Extract\Result
   *   The Solarium extract result object.
   *
   * @throws \Drupal\search_api_solr\SearchApiSolrException
   */
  public function extract(QueryInterface $query, ?Endpoint $endpoint = NULL);

  /**
   * Gets the content from an extract query result.
   *
   * @param \Solarium\QueryType\Extract\Result $result
   *   The Solarium extract result object.
   * @param string $filepath
   *   The filepath to look for in results.
   *
   * @return string
   *   The extracted content as string.
   *
   * @throws \Drupal\search_api_solr\SearchApiSolrException
   */
  public function getContentFromExtractResult(ExtractResult $result, $filepath);

  /**
   * Returns an endpoint.
   *
   * @param string $key
   *   The endpoint ID.
   *
   * @return \Solarium\Core\Client\Endpoint
   *   The Solarium endpoint object.
   *
   * @throws \Solarium\Exception\OutOfBoundsException
   */
  public function getEndpoint($key = 'search_api_solr');

  /**
   * Creates an endpoint.
   *
   * @param string $key
   *   The endpoint ID.
   * @param array $additional_configuration
   *   Configuration in addtion to the default configuration.
   *
   * @return \Solarium\Core\Client\Endpoint
   *   The Solarium endpoint object.
   */
  public function createEndpoint(string $key, array $additional_configuration = []);

  /**
   * Retrieves a config file or file list from the Solr server.
   *
   * Uses the admin/file request handler.
   *
   * @param 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 \Solarium\Core\Client\Response
   *   A Solarium response object containing either the file contents or a file
   *   list.
   *
   * @throws \Drupal\search_api_solr\SearchApiSolrException
   */
  public function getFile($file = NULL);

  /**
   * Returns additional, connector-specific information about this server.
   *
   * This information will be then added to the server's "View" tab in some way.
   * In the default theme implementation the data is output in a table with two
   * columns along with other, generic information about the server.
   *
   * @return array
   *   An array of additional server information, with each piece of information
   *   being an associative array with the following keys:
   *   - label: The human-readable label for this data.
   *   - info: The information, as HTML.
   *   - status: (optional) The status associated with this information. One of
   *     "info", "ok", "warning" or "error". Defaults to "info".
   */
  public function viewSettings();

  /**
   * Reloads the Solr core.
   *
   * @return bool
   *   TRUE if successful, FALSE otherwise.
   *
   * @throws \Drupal\search_api_solr\SearchApiSolrException
   */
  public function reloadCore();

  /**
   * Sets a new timeout for queries, but not for indexing or optimization.
   *
   * The timeout will not be saved in the configuration of the connector. It
   * will be overwritten for the current request only.
   *
   * @param int $timeout
   *   The new query timeout value to set.
   * @param \Solarium\Core\Client\Endpoint|null $endpoint
   *   (optional) The Solarium endpoint object.
   *
   * @return int
   *   The previous query timeout value.
   *
   * @deprecated use useTim
   */
  public function adjustTimeout(int $timeout, ?Endpoint &$endpoint = NULL);

  /**
   * Get the query timeout.
   *
   * @param \Solarium\Core\Client\Endpoint|null $endpoint
   *   (optional) The Solarium endpoint object.
   *
   * @return int
   *   The current query timeout value.
   */
  public function getTimeout(?Endpoint $endpoint = NULL);

  /**
   * Get the index timeout.
   *
   * @param \Solarium\Core\Client\Endpoint|null $endpoint
   *   (optional) The Solarium endpoint object.
   *
   * @return int
   *   The current index timeout value.
   */
  public function getIndexTimeout(?Endpoint $endpoint = NULL);

  /**
   * Get the optimize timeout.
   *
   * @param \Solarium\Core\Client\Endpoint|null $endpoint
   *   (optional) The Solarium endpoint object.
   *
   * @return int
   *   The current optimize timeout value.
   */
  public function getOptimizeTimeout(?Endpoint $endpoint = NULL);

  /**
   * Get the finalize timeout.
   *
   * @param \Solarium\Core\Client\Endpoint|null $endpoint
   *   (optional) The Solarium endpoint object.
   *
   * @return int
   *   The current finalize timeout value.
   */
  public function getFinalizeTimeout(?Endpoint $endpoint = NULL);

  /**
   * Alter the newly assembled Solr configuration files.
   *
   * @param string[] $files
   *   Array of config files keyed by file names.
   * @param string $lucene_match_version
   *   Lucene (Solr) minor version string.
   * @param string $server_id
   *   Optional Search API server id. Will be set in most cases but might be
   *   empty when the config generation is triggered via UI or drush.
   */
  public function alterConfigFiles(array &$files, string $lucene_match_version, string $server_id = '');

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigurableInterface::defaultConfiguration public function Gets default configuration for this plugin. 11
ConfigurableInterface::getConfiguration public function Gets this plugin's configuration. 12
ConfigurableInterface::setConfiguration public function Sets the configuration for this plugin instance. 12
SolrConnectorInterface::adjustTimeout Deprecated public function Sets a new timeout for queries, but not for indexing or optimization. 1
SolrConnectorInterface::alterConfigFiles public function Alter the newly assembled Solr configuration files. 1
SolrConnectorInterface::coreRestGet public function Sends a REST GET request to the Solr core and returns the result. 1
SolrConnectorInterface::coreRestPost public function Sends a REST POST request to the Solr core and returns the result. 1
SolrConnectorInterface::createEndpoint public function Creates an endpoint. 1
SolrConnectorInterface::createSearchResult public function Creates a result from a response. 1
SolrConnectorInterface::execute public function Executes any query. 1
SolrConnectorInterface::executeRequest public function Executes a request and returns the response. 1
SolrConnectorInterface::extract public function Executes an extract query. 1
SolrConnectorInterface::FINALIZE_TIMEOUT constant
SolrConnectorInterface::getAutocompleteQuery public function Creates a new Solarium autocomplete query. 1
SolrConnectorInterface::getContentFromExtractResult public function Gets the content from an extract query result. 1
SolrConnectorInterface::getCoreInfo public function Gets information about the Solr Core. 1
SolrConnectorInterface::getCoreLink public function Returns a link to the Solr core, if the necessary options are set. 1
SolrConnectorInterface::getEndpoint public function Returns an endpoint. 1
SolrConnectorInterface::getExtractQuery public function Creates a new Solarium extract query. 1
SolrConnectorInterface::getFile public function Retrieves a config file or file list from the Solr server. 1
SolrConnectorInterface::getFinalizeTimeout public function Get the finalize timeout. 1
SolrConnectorInterface::getIndexTimeout public function Get the index timeout. 1
SolrConnectorInterface::getLuceneMatchVersion public function Gets the LuceneMatchVersion string. 1
SolrConnectorInterface::getLuke public function Gets meta-data about the index. 1
SolrConnectorInterface::getMoreLikeThisQuery public function Creates a new Solarium more like this query. 1
SolrConnectorInterface::getOptimizeTimeout public function Get the optimize timeout. 1
SolrConnectorInterface::getQueryHelper public function Returns a Solarium query helper object. 1
SolrConnectorInterface::getSchemaVersion public function Gets the schema version number. 1
SolrConnectorInterface::getSchemaVersionString public function Gets the full schema version string the core is using. 1
SolrConnectorInterface::getSelectQuery public function Creates a new Solarium update query. 1
SolrConnectorInterface::getServerInfo public function Gets information about the Solr server. 1
SolrConnectorInterface::getServerLink public function Returns a link to the Solr server. 1
SolrConnectorInterface::getSolrBranch public function Gets the current Solr branch name. 1
SolrConnectorInterface::getSolrMajorVersion public function Gets the current Solr major version. 1
SolrConnectorInterface::getSolrVersion public function Gets the current Solr version. 1
SolrConnectorInterface::getSpellcheckQuery public function Creates a new Solarium suggester query. 1
SolrConnectorInterface::getStatsSummary public function Gets summary information about the Solr Core. 1
SolrConnectorInterface::getSuggesterQuery public function Creates a new Solarium suggester query. 1
SolrConnectorInterface::getTermsQuery public function Creates a new Solarium terms query. 1
SolrConnectorInterface::getTimeout public function Get the query timeout. 1
SolrConnectorInterface::getUpdateQuery public function Creates a new Solarium update query. 1
SolrConnectorInterface::INDEX_TIMEOUT constant
SolrConnectorInterface::isCloud public function Returns TRUE for Cloud. 1
SolrConnectorInterface::optimize public function Optimizes the Solr index. 1
SolrConnectorInterface::OPTIMIZE_TIMEOUT constant
SolrConnectorInterface::pingCore public function Pings the Solr core to tell whether it can be accessed. 1
SolrConnectorInterface::pingServer public function Pings the Solr server to tell whether it can be accessed. 1
SolrConnectorInterface::QUERY_TIMEOUT constant
SolrConnectorInterface::reloadCore public function Reloads the Solr core. 1
SolrConnectorInterface::search public function Executes a search query and returns the raw response. 1
SolrConnectorInterface::serverRestGet public function Sends a REST GET request to the Solr server and returns the result. 1
SolrConnectorInterface::serverRestPost public function Sends a REST POST request to the Solr server and returns the result. 1
SolrConnectorInterface::update public function Executes an update query and applies some tweaks. 1
SolrConnectorInterface::viewSettings public function Returns additional, connector-specific information about this server. 1