You are here

interface SolrBackendInterface in Search API Solr 8.3

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

Defines an interface for Solr search backend plugins.

It extends the generic \Drupal\search_api\Backend\BackendInterface and covers additional Solr specific methods.

Hierarchy

Expanded class hierarchy of SolrBackendInterface

All classes that implement SolrBackendInterface

14 files declare their use of SolrBackendInterface
BackendTrait.php in src/Controller/BackendTrait.php
IndexSolrMultisiteCloneForm.php in src/Form/IndexSolrMultisiteCloneForm.php
LocalActionAccessCheck.php in src/Access/LocalActionAccessCheck.php
SearchApiSolrBackend.php in src/Plugin/search_api/backend/SearchApiSolrBackend.php
SearchApiSolrCommands.php in src/Commands/SearchApiSolrCommands.php

... See full list

File

src/SolrBackendInterface.php, line 17

Namespace

Drupal\search_api_solr
View source
interface SolrBackendInterface extends BackendInterface {

  /**
   * The minimum required Solr schema version.
   */
  const SEARCH_API_SOLR_MIN_SCHEMA_VERSION = '8.3.10';

  /**
   * The separator to indicate the start of a language ID.
   *
   * We must not use any character that has a special meaning within regular
   * expressions. Additionally we have to avoid characters that are valid for
   * Drupal machine names.
   * The end of a language ID is indicated by an underscore '_' which could not
   * occur within the language ID itself because Drupal uses lanague tags.
   *
   * @see http://de2.php.net/manual/en/regexp.reference.meta.php
   * @see https://www.w3.org/International/articles/language-tags/
   */
  const SEARCH_API_SOLR_LANGUAGE_SEPARATOR = ';';

  /**
   * Creates a list of all indexed field names mapped to their Solr field names.
   *
   * The special fields "search_api_id" and "search_api_relevance" are also
   * included. Any Solr fields that exist on search results are mapped back to
   * to their local field names in the final result set.
   *
   * @param \Drupal\search_api\IndexInterface $index
   *   The Search Api index.
   * @param bool $reset
   *   (optional) Whether to reset the static cache.
   *
   * @throws \Drupal\search_api\SearchApiException
   *
   * @see SearchApiSolrBackend::search()
   */
  public function getSolrFieldNames(IndexInterface $index, $reset = FALSE);

  /**
   * Gets a language-specific mapping from Drupal to Solr field names.
   *
   * @param string $language_id
   *   The language to get the mapping for.
   * @param \Drupal\search_api\IndexInterface $index
   *   The Search API index entity.
   * @param bool $reset
   *   (optional) Whether to reset the static cache.
   *
   * @return array
   *   The language-specific mapping from Drupal to Solr field names.
   *
   * @throws \Drupal\search_api\SearchApiException
   */
  public function getLanguageSpecificSolrFieldNames($language_id, ?IndexInterface $index, $reset = FALSE);

  /**
   * Gets a language-specific mapping from Drupal to Solr field names.
   *
   * @param array $language_ids
   *   The language to get the mapping for.
   * @param \Drupal\search_api\IndexInterface $index
   *   The Search API index entity.
   * @param bool $reset
   *   (optional) Whether to reset the static cache.
   *
   * @return array
   *   The language-specific mapping from Drupal to Solr field names.
   *
   * @throws \Drupal\search_api\SearchApiException
   */
  public function getSolrFieldNamesKeyedByLanguage(array $language_ids, IndexInterface $index, $reset = FALSE);

  /**
   * Returns the Solr connector used for this backend.
   *
   * @return \Drupal\search_api_solr\SolrConnectorInterface
   *   The Solr connector object.
   *
   * @throws \Drupal\search_api\SearchApiException
   */
  public function getSolrConnector();

  /**
   * Retrieves a Solr document from an search api index item.
   *
   * @param \Drupal\search_api\IndexInterface $index
   *   The Search API index entity.
   * @param \Drupal\search_api\Item\ItemInterface $item
   *   An item to get documents for.
   *
   * @return \Solarium\QueryType\Update\Query\Document
   *   A solr document.
   *
   * @throws \Drupal\search_api\SearchApiException
   */
  public function getDocument(IndexInterface $index, ItemInterface $item);

  /**
   * Retrieves Solr documents from search api index items.
   *
   * @param \Drupal\search_api\IndexInterface $index
   *   The Search API index.
   * @param \Drupal\search_api\Item\ItemInterface[] $items
   *   An array of items to get documents for.
   * @param \Solarium\QueryType\Update\Query\Query $update_query
   *   The existing update query the documents should be added to.
   *
   * @return \Solarium\QueryType\Update\Query\Document[]
   *   An array of solr documents.
   *
   * @throws \Drupal\search_api\SearchApiException
   */
  public function getDocuments(IndexInterface $index, array $items, UpdateQuery $update_query = NULL);

  /**
   * Extract a file's content using tika within a solr server.
   *
   * @param string $filepath
   *   The real path of the file to be extracted.
   *
   * @return string
   *   The text extracted from the file.
   *
   * @throws \Drupal\search_api\SearchApiException
   */
  public function extractContentFromFile($filepath);

  /**
   * Returns the targeted content domain of the server.
   *
   * @return string
   *   The content domain.
   */
  public function getDomain();

  /**
   * Returns the targeted environment of the server.
   *
   * @return string
   *   The environment.
   */
  public function getEnvironment();

  /**
   * Indicates if the Solr server uses a managed schema.
   *
   * @return bool
   *   TRUE if the Solr server uses a managed schema, FALSE if the Solr server
   *   uses a classic schema.
   */
  public function isManagedSchema();

  /**
   * Indicates if the Solr index should be optimized daily.
   *
   * @return bool
   *   TRUE if the Solr index should be optimized daily, FALSE otherwise.
   */
  public function isOptimizeEnabled();

  /**
   * Returns a ready to use query string to filter results by index and site.
   *
   * @param \Drupal\search_api\IndexInterface $index
   *   The Search API index entity.
   *
   * @return string
   *   The query string filter.
   */
  public function getIndexFilterQueryString(IndexInterface $index);

  /**
   * Returns the endpoint to use for the index.
   *
   * In case of Solr Cloud an index might use a different Solr collection.
   *
   * @param \Drupal\search_api\IndexInterface $index
   *
   * @return \Solarium\Core\Client\Endpoint
   *
   * @throws \Drupal\Component\Plugin\Exception\PluginException
   * @throws \Drupal\search_api\SearchApiException
   */
  public function getCollectionEndpoint(IndexInterface $index);

  /**
   * Returns the Solr settings for the given index.
   *
   * @param \Drupal\search_api\IndexInterface $index
   *   The Search API index entity.
   *
   * @return array
   *   An associative array of settings.
   *
   * @deprecated use \Drupal\search_api_solr\Utility\Utility::getIndexSolrSettings()
   */
  public function getIndexSolrSettings(IndexInterface $index);

  /**
   * Prefixes an index ID as configured.
   *
   * The resulting ID will be a concatenation of the following strings:
   * - If set, the server-specific index_prefix.
   * - If set, the index-specific prefix.
   * - The index's machine name.
   *
   * @param \Drupal\search_api\IndexInterface $index
   *   The Search API index entity.
   *
   * @return string
   *   The prefixed machine name.
   */
  public function getIndexId(IndexInterface $index);

  /**
   * Returns the targeted Index ID. In case of multisite it might differ.
   *
   * @param \Drupal\search_api\IndexInterface $index
   *   The Search API index entity.
   *
   * @return string
   *   The targeted Index ID.
   *
   * @throws \Drupal\search_api\SearchApiException
   */
  public function getTargetedIndexId(IndexInterface $index);

  /**
   * Returns the targeted site hash. In case of multisite it might differ.
   *
   * @param \Drupal\search_api\IndexInterface $index
   *   The Search API index entity.
   *
   * @return string
   *   The targeted site hash.
   *
   * @throws \Drupal\search_api\SearchApiException
   */
  public function getTargetedSiteHash(IndexInterface $index);

  /**
   * Executes a streaming expression.
   *
   * @param \Drupal\search_api\Query\QueryInterface $query
   *   The query used for the streaming expression.
   *
   * @return \Solarium\QueryType\Stream\Result
   *   The streaming expression result.
   *
   * @throws \Drupal\search_api\SearchApiException
   * @throws \Drupal\search_api_solr\SearchApiSolrException
   */
  public function executeStreamingExpression(QueryInterface $query);

  /**
   * Executes a graph streaming expression.
   *
   * @param \Drupal\search_api\Query\QueryInterface $query
   *   The query used for the graph streaming expression.
   *
   * @return \Solarium\QueryType\Graph\Result
   *   The graph streaming expression result.
   *
   * @throws \Drupal\search_api\SearchApiException
   * @throws \Drupal\search_api_solr\SearchApiSolrException
   */
  public function executeGraphStreamingExpression(QueryInterface $query);

  /**
   * Apply any finalization commands to a solr index.
   *
   * Only if globally configured to do so and only the first time after changes
   * to the index from the drupal side.
   *
   * @param \Drupal\search_api\IndexInterface $index
   *   The Search API index entity.
   *
   * @return bool
   *   TRUE if a finalization run, FALSE otherwise. FALSE doesn't indicate an
   *   error!
   *
   * @throws \Drupal\Component\Plugin\Exception\PluginException
   * @throws \Drupal\search_api\SearchApiException
   * @throws \Drupal\search_api_solr\SearchApiSolrException
   */
  public function finalizeIndex(IndexInterface $index);

  /**
   * Gets schema language statistics for the multilingual Solr server.
   *
   * @return array
   *   Stats as associative array keyed by language IDs and a boolean value to
   *   indicate if corresponding field types are existing on the server's
   *   current schema.
   *
   * @throws \Drupal\Component\Plugin\Exception\PluginException
   * @throws \Drupal\search_api\SearchApiException
   * @throws \Drupal\search_api_solr\SearchApiSolrException
   */
  public function getSchemaLanguageStatistics();

  /**
   * Get document counts for this server, in total and per site / index.
   *
   * @return array
   *   An associative array of document counts.
   *
   * @throws \Drupal\Component\Plugin\Exception\PluginException
   * @throws \Drupal\search_api\SearchApiException
   * @throws \Drupal\search_api_solr\SearchApiSolrException
   */
  public function getDocumentCounts();

  /**
   * Get the max document versions, in total and per site / index / datasource.
   *
   * _version_ numbers are important for replication and checkpoints.
   *
   * @return array
   *   An associative array of max document versions.
   *
   * @throws \Drupal\Component\Plugin\Exception\PluginException
   * @throws \Drupal\search_api\SearchApiException
   * @throws \Drupal\search_api_solr\SearchApiSolrException
   */
  public function getMaxDocumentVersions();

  /**
   * Gets a list of Solr Field Types that are disabled for this backend.
   *
   * @return String[]
   */
  public function getDisabledFieldTypes() : array;

  /**
   * Gets a list of Solr Caches that are disabled for this backend.
   *
   * @return String[]
   */
  public function getDisabledCaches() : array;

  /**
   * Gets a list of Solr Request Handlers that are disabled for this backend.
   *
   * @return String[]
   */
  public function getDisabledRequestHandlers() : array;

  /**
   * Gets a list of Solr Request Dispatchers that are disabled for this backend.
   *
   * @return String[]
   */
  public function getDisabledRequestDispatchers() : array;

  /**
   * Indicates if the the current Solr config should not be verified.
   *
   * @return bool
   */
  public function isNonDrupalOrOutdatedConfigSetAllowed() : bool;

}

Members

Namesort descending Modifiers Type Description Overrides
BackendInterface::getServer public function Retrieves the server entity for this backend. 1
BackendInterface::postInsert public function Reacts to the server's creation. 1
BackendInterface::postUpdate public function Notifies the backend that its configuration was updated. 1
BackendInterface::preDelete public function Notifies the backend that the server is about to be deleted. 1
BackendInterface::preUpdate public function Notifies the backend that its configuration is about to be updated. 1
BackendInterface::setServer public function Sets the server entity for this backend. 1
BackendSpecificInterface::addIndex public function Adds a new index to this server. 2
BackendSpecificInterface::deleteAllIndexItems public function Deletes all the items from the index. 4
BackendSpecificInterface::deleteItems public function Deletes the specified items from the index. 4
BackendSpecificInterface::getBackendDefinedFields public function Provides information on additional fields made available by the backend. 2
BackendSpecificInterface::getDiscouragedProcessors public function Limits the processors displayed in the UI for indexes on this server. 2
BackendSpecificInterface::getSupportedFeatures public function Returns all features that this backend supports. 2
BackendSpecificInterface::indexItems public function Indexes the specified items. 4
BackendSpecificInterface::isAvailable public function Returns a boolean with the availability of the backend. 2
BackendSpecificInterface::removeIndex public function Removes an index from this server. 2
BackendSpecificInterface::search public function Executes a search on this server. 4
BackendSpecificInterface::supportsDataType public function Determines whether the backend supports a given add-on data type. 2
BackendSpecificInterface::updateIndex public function Notifies the server that an index attached to it has been changed. 2
BackendSpecificInterface::viewSettings public function Returns additional, backend-specific information about this server. 2
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
ConfigurablePluginInterface::getDescription public function Returns the plugin's description. 1
ConfigurablePluginInterface::label public function Returns the label for use on the administration pages. 1
ConfigurablePluginInterface::onDependencyRemoval public function Informs the plugin that some of its dependencies are being removed. 1
ContainerFactoryPluginInterface::create public static function Creates an instance of the plugin. 112
DependentPluginInterface::calculateDependencies public function Calculates dependencies for the configured plugin. 19
DerivativeInspectionInterface::getBaseId public function Gets the base_plugin_id of the plugin instance. 1
DerivativeInspectionInterface::getDerivativeId public function Gets the derivative_id of the plugin instance. 1
HideablePluginInterface::isHidden public function Determines whether this plugin should be hidden in the UI. 1
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2
SolrBackendInterface::executeGraphStreamingExpression public function Executes a graph streaming expression. 1
SolrBackendInterface::executeStreamingExpression public function Executes a streaming expression. 1
SolrBackendInterface::extractContentFromFile public function Extract a file's content using tika within a solr server. 1
SolrBackendInterface::finalizeIndex public function Apply any finalization commands to a solr index. 1
SolrBackendInterface::getCollectionEndpoint public function Returns the endpoint to use for the index. 1
SolrBackendInterface::getDisabledCaches public function Gets a list of Solr Caches that are disabled for this backend. 1
SolrBackendInterface::getDisabledFieldTypes public function Gets a list of Solr Field Types that are disabled for this backend. 1
SolrBackendInterface::getDisabledRequestDispatchers public function Gets a list of Solr Request Dispatchers that are disabled for this backend. 1
SolrBackendInterface::getDisabledRequestHandlers public function Gets a list of Solr Request Handlers that are disabled for this backend. 1
SolrBackendInterface::getDocument public function Retrieves a Solr document from an search api index item. 1
SolrBackendInterface::getDocumentCounts public function Get document counts for this server, in total and per site / index. 1
SolrBackendInterface::getDocuments public function Retrieves Solr documents from search api index items. 1
SolrBackendInterface::getDomain public function Returns the targeted content domain of the server. 1
SolrBackendInterface::getEnvironment public function Returns the targeted environment of the server. 1
SolrBackendInterface::getIndexFilterQueryString public function Returns a ready to use query string to filter results by index and site. 1
SolrBackendInterface::getIndexId public function Prefixes an index ID as configured. 1
SolrBackendInterface::getIndexSolrSettings Deprecated public function Returns the Solr settings for the given index. 1
SolrBackendInterface::getLanguageSpecificSolrFieldNames public function Gets a language-specific mapping from Drupal to Solr field names. 1
SolrBackendInterface::getMaxDocumentVersions public function Get the max document versions, in total and per site / index / datasource. 1
SolrBackendInterface::getSchemaLanguageStatistics public function Gets schema language statistics for the multilingual Solr server. 1
SolrBackendInterface::getSolrConnector public function Returns the Solr connector used for this backend. 1
SolrBackendInterface::getSolrFieldNames public function Creates a list of all indexed field names mapped to their Solr field names. 1
SolrBackendInterface::getSolrFieldNamesKeyedByLanguage public function Gets a language-specific mapping from Drupal to Solr field names. 1
SolrBackendInterface::getTargetedIndexId public function Returns the targeted Index ID. In case of multisite it might differ. 1
SolrBackendInterface::getTargetedSiteHash public function Returns the targeted site hash. In case of multisite it might differ. 1
SolrBackendInterface::isManagedSchema public function Indicates if the Solr server uses a managed schema. 1
SolrBackendInterface::isNonDrupalOrOutdatedConfigSetAllowed public function Indicates if the the current Solr config should not be verified. 1
SolrBackendInterface::isOptimizeEnabled public function Indicates if the Solr index should be optimized daily. 1
SolrBackendInterface::SEARCH_API_SOLR_LANGUAGE_SEPARATOR constant The separator to indicate the start of a language ID.
SolrBackendInterface::SEARCH_API_SOLR_MIN_SCHEMA_VERSION constant The minimum required Solr schema version.