You are here

function search_api_solr_update_8316 in Search API Solr 4.x

Same name and namespace in other branches
  1. 8.3 search_api_solr.install \search_api_solr_update_8316()

Use Ukrainian lemmatization instead of Russian SnowballPorterFilterFactory.

File

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

Code

function search_api_solr_update_8316() {
  foreach (search_api_solr_update_helper_get_field_type_configs() as $field_type_name => $field_type_config) {
    if ('uk' === $field_type_config['field_type_language_code'] && !empty($field_type_config['field_type'])) {
      foreach ($field_type_config['field_type'] as &$components) {
        if (is_array($components)) {
          foreach ($components as &$analyzers) {
            if (is_array($analyzers)) {
              foreach ($analyzers['filters'] as $key => &$filter) {
                if ('solr.SnowballPorterFilterFactory' === $filter['class']) {
                  $filter['class'] = 'solr.MorfologikFilterFactory';
                  unset($filter['language']);
                  unset($filter['protected']);
                  $filter['dictionary'] = 'org/apache/lucene/analysis/uk/ukrainian.dict';
                }
              }
            }
          }
        }
      }
      search_api_solr_update_helper_save_field_type_config($field_type_name, $field_type_config);
    }
  }
}