function search_api_solr_update_8315 in Search API Solr 8.3
Same name and namespace in other branches
- 4.x search_api_solr.install \search_api_solr_update_8315()
Avoid Solr exceptions.
Avoid Solr exceptions when multilingual spell checking by using unified analyzer.
File
- ./
search_api_solr.install, line 1343 - Install, update and uninstall functions for the Search API Solr module.
Code
function search_api_solr_update_8315() {
foreach (search_api_solr_update_helper_get_field_type_configs() as $field_type_name => $field_type_config) {
if (!empty($field_type_config['spellcheck_field_type'])) {
if (!in_array($field_type_config['field_type_language_code'], [
'und',
'ja',
'th',
'zh-hans',
'zh-hant',
])) {
unset($field_type_config['spellcheck_field_type']);
}
if (!empty($field_type_config['solr_configs']) && !empty($field_type_config['solr_configs']['searchComponents'])) {
foreach ($field_type_config['solr_configs']['searchComponents'] as &$component) {
if ('spellcheck' === $component['name']) {
if (isset($component['lst']) && is_array($component['lst'])) {
foreach ($component['lst'] as &$lst) {
if ('spellchecker' === $lst['name']) {
$lst['str'][] = [
'name' => 'onlyMorePopular',
'VALUE' => 'true',
];
}
}
}
}
}
}
search_api_solr_update_helper_save_field_type_config($field_type_name, $field_type_config);
}
}
}