You are here

function hook_search_api_solr_field_mapping_alter in Search API Solr 4.x

Same name and namespace in other branches
  1. 8.3 search_api_solr.api.php \hook_search_api_solr_field_mapping_alter()
  2. 8 search_api_solr.api.php \hook_search_api_solr_field_mapping_alter()
  3. 8.2 search_api_solr.api.php \hook_search_api_solr_field_mapping_alter()
  4. 7 search_api_solr.api.php \hook_search_api_solr_field_mapping_alter()

Change the way the index's field names are mapped to Solr field names.

Parameters

\Drupal\search_api\IndexInterface $index: The index whose field mappings are altered.

array $fields: An associative array containing the index field names mapped to their Solr counterparts. The special fields 'search_api_id' and 'search_api_relevance' are also included.

string $language_id: The language ID that applies for this field mapping.

1 invocation of hook_search_api_solr_field_mapping_alter()
SearchApiSolrBackend::formatSolrFieldNames in src/Plugin/search_api/backend/SearchApiSolrBackend.php
Returns a language-specific mapping from Drupal to Solr field names.

File

./search_api_solr.api.php, line 143
Hooks provided by the Search API Solr search module.

Code

function hook_search_api_solr_field_mapping_alter(\Drupal\search_api\IndexInterface $index, array &$fields, string $language_id) {
  $fields['fieldname'] = 'ss_fieldname';
}