You are here

function hook_search_api_solr_field_mapping_alter in Search API Solr 8.2

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

\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.

2 invocations of hook_search_api_solr_field_mapping_alter()
SearchApiSolrAnySchemaBackend::getSolrFieldNames in src/Plugin/search_api/backend/SearchApiSolrAnySchemaBackend.php
Override the default fields that Search API Solr sets up. In particular, set the ID field to the one that is configured via the datasource config form.
SearchApiSolrBackend::getSolrFieldNames in src/Plugin/search_api/backend/SearchApiSolrBackend.php
Creates a list of all indexed field names mapped to their Solr field names.

File

./search_api_solr.api.php, line 147
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) {
  $fields['body'] = 'ts_body';
}