function search_api_solr_update_8311 in Search API Solr 4.x
Same name and namespace in other branches
- 8.3 search_api_solr.install \search_api_solr_update_8311()
Add the Polish diacritics to the language configs. Unset the obsolete min and max parameters from the CJKWidthFilter of the spellchecker (mainly for Japanese).
File
- ./
search_api_solr.install, line 1148 - Install, update and uninstall functions for the Search API Solr module.
Code
function search_api_solr_update_8311() {
$accents = <<<ACCENTS
# Ą => A
"\\u0104" => "A"
# Ć => C
"\\u0106" => "C"
# Ę => E
"\\u0118" => "E"
# Ł => L
"\\u0141" => "L"
# Ń => N
"\\u0143" => "N"
# Ś => S
"\\u015a" => "S"
# Ź => Z
"\\u0179" => "Z"
# Ż => Z
"\\u017b" => "Z"
ACCENTS;
foreach (search_api_solr_update_helper_get_field_type_configs() as $field_type_name => $field_type_config) {
if (!empty($field_type_config['text_files']['accents'])) {
if ('pl' === $field_type_config['field_type_language_code']) {
continue;
}
if (strpos($field_type_config['text_files']['accents'], '\\u0104') !== FALSE) {
continue;
}
$field_type_config['text_files']['accents'] = $field_type_config['text_files']['accents'] . $accents;
}
if (!empty($field_type_config['spellcheck_field_type']) && !empty($field_type_config['spellcheck_field_type']['analyzers'])) {
foreach ($field_type_config['spellcheck_field_type']['analyzers'] as &$component) {
if (!empty($component['filters'])) {
foreach ($component['filters'] as &$filter) {
if ('solr.CJKWidthFilterFactory' === $filter['class']) {
unset($filter['min']);
unset($filter['max']);
}
}
}
}
}
search_api_solr_update_helper_save_field_type_config($field_type_name, $field_type_config);
}
}