You are here

class SolrMultisiteFieldManager in Search API Solr 4.x

Same name and namespace in other branches
  1. 8.3 src/SolrMultisiteFieldManager.php \Drupal\search_api_solr\SolrMultisiteFieldManager

Manages the discovery of Solr fields.

Hierarchy

Expanded class hierarchy of SolrMultisiteFieldManager

1 string reference to 'SolrMultisiteFieldManager'
search_api_solr.services.yml in ./search_api_solr.services.yml
search_api_solr.services.yml
1 service uses SolrMultisiteFieldManager
solr_multisite_field.manager in ./search_api_solr.services.yml
Drupal\search_api_solr\SolrMultisiteFieldManager

File

src/SolrMultisiteFieldManager.php, line 11

Namespace

Drupal\search_api_solr
View source
class SolrMultisiteFieldManager extends SolrFieldManager {

  /**
   * Builds the field definitions for a multisite index.
   *
   * @param \Drupal\search_api\IndexInterface $index
   *   The index from which we are retrieving field information.
   *
   * @return \Drupal\Core\TypedData\DataDefinitionInterface[]
   *   The array of field definitions for the server, keyed by field name.
   */
  protected function buildFieldDefinitions(IndexInterface $index) {
    $fields = [];
    foreach ($index
      ->getFields() as $index_field) {
      $solr_field = $index_field
        ->getPropertyPath();
      $field = new SolrMultisiteFieldDefinition([
        'multivalued' => preg_match('/^[a-z]+m_/', $solr_field),
      ]);
      $field
        ->setLabel($index_field
        ->getLabel());
      $field
        ->setDataType($index_field
        ->getType());
      $fields[$solr_field] = $field;
    }
    return $fields;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SolrFieldManager::$fieldDefinitions protected property Static cache of field definitions per Solr server.
SolrFieldManager::$serverStorage protected property Storage for Search API servers.
SolrFieldManager::buildFieldDefinitionsFromConfig protected function Builds the field definitions from exiting index config.
SolrFieldManager::buildFieldDefinitionsFromSolr protected function Builds the field definitions for a Solr server from its Luke handler.
SolrFieldManager::getFieldDefinitions public function Overrides SolrFieldManagerInterface::getFieldDefinitions
SolrFieldManager::__construct public function Constructs a new SorFieldManager.
SolrMultisiteFieldManager::buildFieldDefinitions protected function Builds the field definitions for a multisite index. Overrides SolrFieldManager::buildFieldDefinitions
StringTranslationTrait::$stringTranslation protected property The string translation service. 4
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.
UseCacheBackendTrait::$cacheBackend protected property Cache backend instance.
UseCacheBackendTrait::$useCaches protected property Flag whether caches should be used or skipped.
UseCacheBackendTrait::cacheGet protected function Fetches from the cache backend, respecting the use caches flag.
UseCacheBackendTrait::cacheSet protected function Stores data in the persistent cache, respecting the use caches flag.