You are here

public function SearchApiSolrBackend::supportsDataType in Search API Solr 8.3

Same name and namespace in other branches
  1. 8 src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::supportsDataType()
  2. 8.2 src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::supportsDataType()
  3. 4.x src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::supportsDataType()

Determines whether the backend supports a given add-on data type.

Parameters

string $type: The identifier of the add-on data type.

Return value

bool TRUE if the backend supports that data type.

Overrides BackendPluginBase::supportsDataType

File

src/Plugin/search_api/backend/SearchApiSolrBackend.php, line 611

Class

SearchApiSolrBackend
Apache Solr backend for search api.

Namespace

Drupal\search_api_solr\Plugin\search_api\backend

Code

public function supportsDataType($type) {
  static $custom_codes = [];
  if (strpos($type, 'solr_text_custom') === 0) {
    [
      ,
      $custom_code,
    ] = explode(':', $type);
    if (empty($custom_codes)) {
      $custom_codes = SolrFieldType::getAvailableCustomCodes();
    }
    return in_array($custom_code, $custom_codes);
  }
  return in_array($type, [
    'location',
    'rpt',
    'solr_string_storage',
    'solr_text_omit_norms',
    'solr_text_suggester',
    'solr_text_spellcheck',
    'solr_text_unstemmed',
    'solr_text_wstoken',
    'solr_date_range',
  ]);
}