You are here

function search_api_solr_update_8207 in Search API Solr 8.3

Same name and namespace in other branches
  1. 8.2 search_api_solr.install \search_api_solr_update_8207()
  2. 4.x search_api_solr.install \search_api_solr_update_8207()

Fix language undefined field types.

File

./search_api_solr.install, line 704
Install, update and uninstall functions for the Search API Solr module.

Code

function search_api_solr_update_8207() {
  foreach (search_api_solr_update_helper_get_field_type_configs() as $field_type_name => $field_type_config) {
    if (strpos($field_type_name, 'text_und') === 0) {
      $save = FALSE;
      if (!empty($field_type_config['field_type']) && !empty($field_type_config['field_type']['analyzers'])) {
        foreach ($field_type_config['field_type']['analyzers'] as &$component) {
          foreach ($component['filters'] as &$filter) {
            foreach ($filter as &$entry) {
              if ($entry['class'] === 'solr.SnowballPorterFilterFactory') {
                unset($entry);
                $save = TRUE;
              }
            }
          }
        }
      }
      if ($save) {
        search_api_solr_update_helper_save_field_type_config($field_type_name, $field_type_config);
      }
    }
  }
}