function search_api_solr_update_8322 in Search API Solr 4.x
Same name and namespace in other branches
- 8.3 search_api_solr.install \search_api_solr_update_8322()
Fix Thai and Turkish Field Types.
File
- ./
search_api_solr.install, line 1601 - Install, update and uninstall functions for the Search API Solr module.
Code
function search_api_solr_update_8322() {
foreach (search_api_solr_update_helper_get_field_type_configs() as $field_type_name => $field_type_config) {
if (!empty($field_type_config['field_type'])) {
$save = FALSE;
if ('th' === $field_type_config['field_type_language_code']) {
if (!empty($field_type_config['spellcheck_field_type']['analyzer']['filters'])) {
foreach ($field_type_config['spellcheck_field_type']['analyzer']['filters'] as &$filter) {
if ('stopwords_th.txty' === $filter['words']) {
$filter['words'] = 'stopwords_th.txt';
$save = TRUE;
}
}
}
}
if ('tr' === $field_type_config['field_type_language_code']) {
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 ('stopwords_tr.tx' === $filter['words']) {
$filter['words'] = 'stopwords_tr.txt';
$save = TRUE;
}
}
}
}
}
}
}
if ($save) {
search_api_solr_update_helper_save_field_type_config($field_type_name, $field_type_config);
}
}
}
}