You are here

function search_api_solr_update_8201 in Search API Solr 8.2

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

Fix suggester field type.

File

./search_api_solr.install, line 378

Code

function search_api_solr_update_8201() {
  foreach (search_api_solr_update_helper_get_field_type_configs() as $field_type_name => $field_type_config) {
    if (!empty($field_type_config['solr_configs']) && !empty($field_type_config['solr_configs']['searchComponents'])) {
      foreach ($field_type_config['solr_configs']['searchComponents'] as &$component) {
        if ($component['name'] == 'suggest') {
          foreach ($component['lst'] as &$lst) {
            foreach ($lst['str'] as &$str) {
              foreach ($lst['str'] as &$entry) {
                if ($entry['name'] == 'field') {
                  $entry['VALUE'] = 'twm_suggest';
                  search_api_solr_update_helper_save_field_type_config($field_type_name, $field_type_config);
                  break;
                }
              }
            }
          }
        }
      }
    }
  }
}