You are here

function hook_search_api_solr_field_mapping_alter in Search API Solr 7

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. 4.x 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

SearchApiIndex $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.

1 invocation of hook_search_api_solr_field_mapping_alter()
SearchApiSolrService::getFieldNames in includes/service.inc
Create a list of all indexed field names mapped to their Solr field names.

File

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

Code

function hook_search_api_solr_field_mapping_alter(SearchApiIndex $index, array &$fields) {
  if ($index->entity_type == 'node' && isset($fields['body:value'])) {
    $fields['body:value'] = 'text';
  }
}