You are here

class SearchApiSolrMultilingualManagedSchemaBackend in Search API Solr 8.2

Plugin annotation


@SearchApiBackend(
  id = "search_api_solr_multilingual_managed_schema",
  label = @Translation("Multilingual Solr Managed Schema (Experimental, don't use in production)."),
  description = @Translation("Index items using an Solr search server with managed schema for dynamic configuration for multilingual content.")
)

Hierarchy

Expanded class hierarchy of SearchApiSolrMultilingualManagedSchemaBackend

File

src/Plugin/search_api/backend/SearchApiSolrMultilingualManagedSchemaBackend.php, line 17

Namespace

Drupal\search_api_solr\Plugin\search_api\backend
View source
class SearchApiSolrMultilingualManagedSchemaBackend extends AbstractSearchApiSolrMultilingualBackend {

  /**
   * {@inheritdoc}
   */
  public function isManagedSchema() {
    return TRUE;
  }

  /**
   * {@inheritdoc}
   */
  protected function createSolrDynamicField($solr_field_name, $solr_field_type_name) {

    // @todo leverage SolrFieldType::getDynamicFields().
    $command = [
      'add-dynamic-field' => [
        'name' => $solr_field_name,
        'type' => $solr_field_type_name,
        'stored' => TRUE,
        'indexed' => TRUE,
        'multiValued' => strpos($solr_field_name, 'tm_') === 0 ? TRUE : FALSE,
        'termVectors' => strpos($solr_field_name, 't') === 0 ? TRUE : FALSE,
      ],
    ];
    try {
      $this
        ->solrHelper()
        ->coreRestPost('schema', Json::encode($command));
    } catch (SearchApiSolrException $e) {
      watchdog_exception('solr', $e);
      return FALSE;
    }
    return TRUE;
  }

  /**
   * {@inheritdoc}
   */
  protected function createSolrMultilingualFieldType($solr_field_type_name) {

    // @todo replace the hardcoded version extension.
    $field_type_name = 'm_' . Utility::decodeSolrName($solr_field_type_name) . '_5_2_0';

    // Get the field type definition from Drupal.

    /** @var \Drupal\search_api_solr\Entity\SolrFieldType $field_type_entity */
    $field_type_entity = SolrFieldType::load($field_type_name);
    if (!$field_type_entity) {
      throw new SearchApiSolrException("There's no field type {$field_type_name}.");
    }
    $field_type_definition = $field_type_entity
      ->getFieldType();
    $field_type_definition['name'] = $solr_field_type_name;

    // Send the config to Solr.
    $command_json = '{ "add-field-type": ' . Json::encode($field_type_definition) . '}';
    $command_json = str_replace('"' . $field_type_name . '"', '"' . $solr_field_type_name . '"', $command_json);
    try {
      $this
        ->solrHelper()
        ->coreRestPost('schema', $command_json);
    } catch (SearchApiSolrException $e) {
      watchdog_exception('solr', $e);
      return FALSE;
    }
    return TRUE;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AbstractSearchApiSolrMultilingualBackend::$origKeys protected property The unprocessed search keys.
AbstractSearchApiSolrMultilingualBackend::alterSearchApiQuery protected function Adjusts the language filter before converting the query into a Solr query. Overrides SearchApiSolrBackend::alterSearchApiQuery
AbstractSearchApiSolrMultilingualBackend::alterSolrDocuments protected function Replaces language unspecific fulltext fields by language specific ones. Overrides SearchApiSolrBackend::alterSolrDocuments
AbstractSearchApiSolrMultilingualBackend::alterSolrResponseBody protected function @inheritdoc Overrides SearchApiSolrBackend::alterSolrResponseBody
AbstractSearchApiSolrMultilingualBackend::buildConfigurationForm public function Form constructor. Overrides SearchApiSolrBackend::buildConfigurationForm
AbstractSearchApiSolrMultilingualBackend::getAutocompleteFields protected function Get the fields to search for autocomplete terms. Overrides SearchApiSolrBackend::getAutocompleteFields
AbstractSearchApiSolrMultilingualBackend::getFilterQueries protected function Serializes a query's conditions as Solr filter queries. Overrides SearchApiSolrBackend::getFilterQueries
AbstractSearchApiSolrMultilingualBackend::getLanguageSpecificSolrFieldNames protected function Gets a language-specific mapping from Drupal to Solr field names.
AbstractSearchApiSolrMultilingualBackend::getSchemaLanguageStatistics public function Gets schema language statistics for the multilingual Solr server. Overrides SolrMultilingualBackendInterface::getSchemaLanguageStatistics
AbstractSearchApiSolrMultilingualBackend::hasLanguageUndefinedFallback public function Indicates if the fallback for not supported languages is active. Overrides SolrMultilingualBackendInterface::hasLanguageUndefinedFallback
AbstractSearchApiSolrMultilingualBackend::isPartOfSchema protected function Indicates if an 'element' is part of the Solr server's schema.
AbstractSearchApiSolrMultilingualBackend::postQuery protected function Allow custom changes before search results are returned for subclasses. Overrides SearchApiSolrBackend::postQuery
AbstractSearchApiSolrMultilingualBackend::preQuery protected function Modify the query before it is sent to solr. Overrides SearchApiSolrBackend::preQuery
AbstractSearchApiSolrMultilingualBackend::setAutocompleteSuggesterQuery protected function Set the suggester parameters for the solarium autocomplete query. Overrides SearchApiSolrBackend::setAutocompleteSuggesterQuery
AbstractSearchApiSolrMultilingualBackend::setFacets protected function Helper method for creating the facet field parameters. Overrides SearchApiSolrBackend::setFacets
AbstractSearchApiSolrMultilingualBackend::submitConfigurationForm public function Form submission handler. Overrides SearchApiSolrBackend::submitConfigurationForm
AbstractSearchApiSolrMultilingualBackend::validateConfigurationForm public function Form validation handler. Overrides SearchApiSolrBackend::validateConfigurationForm
BackendPluginBase::$messenger protected property The messenger. Overrides MessengerTrait::$messenger
BackendPluginBase::$server protected property The server this backend is configured for.
BackendPluginBase::$serverId protected property The backend's server's ID.
BackendPluginBase::addIndex public function Adds a new index to this server. Overrides BackendSpecificInterface::addIndex 2
BackendPluginBase::getFieldsHelper public function Retrieves the fields helper.
BackendPluginBase::getMessenger public function Retrieves the messenger.
BackendPluginBase::getServer public function Retrieves the server entity for this backend. Overrides BackendInterface::getServer
BackendPluginBase::getSpecialFields protected function Creates dummy field objects for the "magic" fields present for every index. 1
BackendPluginBase::postInsert public function Reacts to the server's creation. Overrides BackendInterface::postInsert 1
BackendPluginBase::postUpdate public function Notifies the backend that its configuration was updated. Overrides BackendInterface::postUpdate 2
BackendPluginBase::preDelete public function Notifies the backend that the server is about to be deleted. Overrides BackendInterface::preDelete 1
BackendPluginBase::preUpdate public function Notifies the backend that its configuration is about to be updated. Overrides BackendInterface::preUpdate 1
BackendPluginBase::setFieldsHelper public function Sets the fields helper.
BackendPluginBase::setMessenger public function Sets the messenger. Overrides MessengerTrait::setMessenger
BackendPluginBase::setServer public function Sets the server entity for this backend. Overrides BackendInterface::setServer
BackendPluginBase::validateOperator protected function Verifies that the given condition operator is valid for this backend.
BackendPluginBase::__sleep public function Implements the magic __sleep() method. Overrides DependencySerializationTrait::__sleep 1
BackendPluginBase::__wakeup public function Implements the magic __wakeup() method. Overrides DependencySerializationTrait::__wakeup 1
ConfigurablePluginBase::calculatePluginDependencies Deprecated protected function Calculates and adds dependencies of a specific plugin instance.
ConfigurablePluginBase::getConfiguration public function Gets this plugin's configuration. Overrides ConfigurableInterface::getConfiguration
ConfigurablePluginBase::getDescription public function Returns the plugin's description. Overrides ConfigurablePluginInterface::getDescription
ConfigurablePluginBase::getPluginDependencies Deprecated protected function Calculates and returns dependencies of a specific plugin instance.
ConfigurablePluginBase::label public function Returns the label for use on the administration pages. Overrides ConfigurablePluginInterface::label
ConfigurablePluginBase::moduleHandler Deprecated protected function Wraps the module handler.
ConfigurablePluginBase::onDependencyRemoval public function Informs the plugin that some of its dependencies are being removed. Overrides ConfigurablePluginInterface::onDependencyRemoval 5
ConfigurablePluginBase::themeHandler Deprecated protected function Wraps the theme handler.
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencyTrait::$dependencies protected property The object's dependencies.
DependencyTrait::addDependencies protected function Adds multiple dependencies.
DependencyTrait::addDependency protected function Adds a dependency.
HideablePluginBase::isHidden public function Determines whether this plugin should be hidden in the UI. Overrides HideablePluginInterface::isHidden 1
LoggerTrait::$logger protected property The logging channel to use.
LoggerTrait::getLogger public function Retrieves the logger.
LoggerTrait::logException protected function Logs an exception.
LoggerTrait::setLogger public function Sets the logger.
MessengerTrait::messenger public function Gets the messenger. 29
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
PluginDependencyTrait::calculatePluginDependencies protected function Calculates and adds dependencies of a specific plugin instance. Aliased as: traitCalculatePluginDependencies 1
PluginDependencyTrait::getPluginDependencies protected function Calculates and returns dependencies of a specific plugin instance. Aliased as: traitGetPluginDependencies
PluginDependencyTrait::moduleHandler protected function Wraps the module handler. Aliased as: traitModuleHandler 1
PluginDependencyTrait::themeHandler protected function Wraps the theme handler. Aliased as: traitThemeHandler 1
PluginFormTrait::submitConfigurationForm public function Form submission handler. Aliased as: traitSubmitConfigurationForm 7
SearchApiSolrBackend::$dataTypeHelper protected property The data type helper.
SearchApiSolrBackend::$fieldNames protected property Metadata describing fields on the Solr/Lucene index.
SearchApiSolrBackend::$fieldsHelper protected property Overrides BackendPluginBase::$fieldsHelper
SearchApiSolrBackend::$languageManager protected property The language manager.
SearchApiSolrBackend::$moduleHandler protected property The module handler.
SearchApiSolrBackend::$queryHelper protected property The Solarium query helper.
SearchApiSolrBackend::$searchApiSolrSettings protected property A config object for 'search_api_solr.settings'.
SearchApiSolrBackend::$solrConnector protected property
SearchApiSolrBackend::$solrConnectorPluginManager protected property The backend plugin manager.
SearchApiSolrBackend::addIndexField protected function Helper method for indexing.
SearchApiSolrBackend::addLanguageConditions protected function Adds item language conditions to the condition group, if applicable.
SearchApiSolrBackend::alterSpellcheckAutocompleteQuery public function Allow custom changes to the Solarium Spellcheck autocomplete query. Overrides SolrAutocompleteInterface::alterSpellcheckAutocompleteQuery
SearchApiSolrBackend::alterSuggesterAutocompleteQuery public function Allow custom changes to the Solarium Suggester autocomplete query. Overrides SolrAutocompleteInterface::alterSuggesterAutocompleteQuery
SearchApiSolrBackend::alterTermsAutocompleteQuery public function Allow custom changes to the Solarium Terms autocomplete query. Overrides SolrAutocompleteInterface::alterTermsAutocompleteQuery
SearchApiSolrBackend::applySearchWorkarounds protected function Apply workarounds for special Solr versions before searching. 1
SearchApiSolrBackend::buildAjaxSolrConnectorConfigForm public static function Handles switching the selected Solr connector plugin.
SearchApiSolrBackend::buildConnectorConfigForm public function Builds the backend-specific configuration form.
SearchApiSolrBackend::calculateDependencies public function Calculates dependencies for the configured plugin. Overrides ConfigurablePluginBase::calculateDependencies
SearchApiSolrBackend::create public static function Creates an instance of the plugin. Overrides BackendPluginBase::create
SearchApiSolrBackend::createFilterQueries protected function Recursively transforms conditions into a flat array of Solr filter queries.
SearchApiSolrBackend::createFilterQuery protected function Create a single search query string.
SearchApiSolrBackend::createId protected function Creates an ID used as the unique identifier at the Solr server.
SearchApiSolrBackend::createLocationFilterQuery protected function Create a single search query string.
SearchApiSolrBackend::defaultConfiguration public function Gets default configuration for this plugin. Overrides ConfigurablePluginBase::defaultConfiguration 1
SearchApiSolrBackend::deleteAllIndexItems public function Deletes all the items from the index. Overrides BackendSpecificInterface::deleteAllIndexItems
SearchApiSolrBackend::deleteItems public function Deletes the specified items from the index. Overrides BackendSpecificInterface::deleteItems
SearchApiSolrBackend::executeGraphStreamingExpression public function Executes a graph streaming expression. Overrides SolrBackendInterface::executeGraphStreamingExpression
SearchApiSolrBackend::executeStreamingExpression public function Executes a streaming expression. Overrides SolrBackendInterface::executeStreamingExpression
SearchApiSolrBackend::extractContentFromFile public function Extract a file's content using tika within a solr server. Overrides SolrBackendInterface::extractContentFromFile
SearchApiSolrBackend::extractFacets protected function Extracts facets from a Solarium result set.
SearchApiSolrBackend::extractResults protected function Extract results from a Solr response.
SearchApiSolrBackend::filterDuplicateAutocompleteSuggestions protected function
SearchApiSolrBackend::finalizeIndex public function Overrides SolrBackendInterface::finalizeIndex
SearchApiSolrBackend::flattenKeys protected function Flattens keys and fields into a single search string.
SearchApiSolrBackend::formatDate public function Tries to format given date with solarium query helper.
SearchApiSolrBackend::formatFilterValue protected function Format a value for filtering on a field of a specific type.
SearchApiSolrBackend::getAutocompleteQuery protected function
SearchApiSolrBackend::getAutocompleteSpellCheckSuggestions protected function Get the spellcheck suggestions from the autocomplete query result.
SearchApiSolrBackend::getAutocompleteSuggesterSuggestions protected function Get the term suggestions from the autocomplete query result.
SearchApiSolrBackend::getAutocompleteSuggestions public function Implements autocomplete compatible to AutocompleteBackendInterface.
SearchApiSolrBackend::getAutocompleteTermSuggestions protected function Get the term suggestions from the autocomplete query result.
SearchApiSolrBackend::getBackendDefinedFields public function Provides information on additional fields made available by the backend. Overrides BackendPluginBase::getBackendDefinedFields
SearchApiSolrBackend::getDiscouragedProcessors public function Limits the processors displayed in the UI for indexes on this server. Overrides BackendPluginBase::getDiscouragedProcessors
SearchApiSolrBackend::getDocument public function Retrieves a Solr document from an search api index item. Overrides SolrBackendInterface::getDocument
SearchApiSolrBackend::getDocuments public function Retrieves Solr documents from search api index items. Overrides SolrBackendInterface::getDocuments
SearchApiSolrBackend::getDomain public function Returns the targeted content domain of the server. Overrides SolrBackendInterface::getDomain
SearchApiSolrBackend::getHighlighting protected function Extract and format highlighting information for a specific item.
SearchApiSolrBackend::getIndexFilterQueryString public function Returns a ready to use query string to filter results by index and site. Overrides SolrBackendInterface::getIndexFilterQueryString
SearchApiSolrBackend::getIndexId protected function Prefixes an index ID as configured.
SearchApiSolrBackend::getMoreLikeThisQuery protected function Changes the query to a "More Like This" query.
SearchApiSolrBackend::getPropertyPathCardinality protected function Computes the cardinality of a complete property path.
SearchApiSolrBackend::getQueryFulltextFields protected function Don't return the big twm_suggest field. Overrides BackendPluginBase::getQueryFulltextFields
SearchApiSolrBackend::getSolrConnector public function Overrides SolrBackendInterface::getSolrConnector
SearchApiSolrBackend::getSolrConnectorOptions protected function Returns all available backend plugins, as an options list.
SearchApiSolrBackend::getSolrFieldNames public function Creates a list of all indexed field names mapped to their Solr field names. Overrides SolrBackendInterface::getSolrFieldNames 1
SearchApiSolrBackend::getSpellcheckSuggestions public function Autocompletion suggestions for some user input using Spellcheck component. Overrides SolrAutocompleteInterface::getSpellcheckSuggestions
SearchApiSolrBackend::getSuggesterSuggestions public function Autocompletion suggestions for some user input using Suggester component. Overrides SolrAutocompleteInterface::getSuggesterSuggestions
SearchApiSolrBackend::getSupportedFeatures public function Returns all features that this backend supports. Overrides BackendPluginBase::getSupportedFeatures
SearchApiSolrBackend::getTermsSuggestions public function Autocompletion suggestions for some user input using Terms component. Overrides SolrAutocompleteInterface::getTermsSuggestions
SearchApiSolrBackend::hasHierarchicalProperties protected function Checks if hierarchical properties are nested on an entity-typed property.
SearchApiSolrBackend::indexFieldsUpdated protected function Checks if the recently updated index had any fields changed.
SearchApiSolrBackend::indexItems public function Indexes the specified items. Overrides BackendSpecificInterface::indexItems
SearchApiSolrBackend::isAvailable public function Overrides BackendPluginBase::isAvailable
SearchApiSolrBackend::isHierarchicalField protected function Checks if a field is (potentially) hierarchical.
SearchApiSolrBackend::reduceFilterQueries protected function Reduces an array of filter queries to an array containing one filter query.
SearchApiSolrBackend::removeIndex public function Removes an index from this server. Overrides BackendPluginBase::removeIndex
SearchApiSolrBackend::search public function Options on $query prefixed by 'solr_param_' will be passed natively to Solr as query parameter without the prefix. For example you can set the "Minimum Should Match" parameter 'mm' to '75%' like this: Overrides BackendSpecificInterface::search
SearchApiSolrBackend::setAutocompleteSpellCheckQuery protected function Set the spellcheck parameters for the solarium autocomplete query.
SearchApiSolrBackend::setAutocompleteTermQuery protected function Set the term parameters for the solarium autocomplete query.
SearchApiSolrBackend::setConfiguration public function Sets the configuration for this plugin instance. Overrides BackendPluginBase::setConfiguration
SearchApiSolrBackend::setFields protected function Set the list of fields Solr should return as result.
SearchApiSolrBackend::setGrouping protected function Sets grouping for the query.
SearchApiSolrBackend::setHighlighting protected function Sets the highlighting parameters.
SearchApiSolrBackend::setRpt protected function Adds rpt spatial features to the search query.
SearchApiSolrBackend::setSorts protected function Sets sorting for the query.
SearchApiSolrBackend::setSpatial protected function Adds spatial features to the search query.
SearchApiSolrBackend::supportsDataType public function Determines whether the backend supports a given add-on data type. Overrides BackendPluginBase::supportsDataType
SearchApiSolrBackend::updateIndex public function Notifies the server that an index attached to it has been changed. Overrides BackendPluginBase::updateIndex
SearchApiSolrBackend::viewSettings public function Overrides BackendPluginBase::viewSettings
SearchApiSolrBackend::__construct public function Constructs a \Drupal\Component\Plugin\PluginBase object. Overrides BackendPluginBase::__construct
SearchApiSolrMultilingualManagedSchemaBackend::createSolrDynamicField protected function Creates and deploys a missing dynamic Solr field if the server supports it. Overrides AbstractSearchApiSolrMultilingualBackend::createSolrDynamicField
SearchApiSolrMultilingualManagedSchemaBackend::createSolrMultilingualFieldType protected function Creates and deploys a missing Solr Field Type if the server supports it. Overrides AbstractSearchApiSolrMultilingualBackend::createSolrMultilingualFieldType
SearchApiSolrMultilingualManagedSchemaBackend::isManagedSchema public function Indicates if the Solr server uses a managed schema. Overrides SearchApiSolrBackend::isManagedSchema
SolrCommitTrait::ensureCommit protected function Explicitly sent a commit command to a Solr server.
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.