You are here

function apachesolr_multilingual_confgen_modify_solrconfig in Apache Solr Multilingual 6.3

Same name and namespace in other branches
  1. 7 apachesolr_multilingual_confgen/apachesolr_multilingual_confgen.generator.inc \apachesolr_multilingual_confgen_modify_solrconfig()
1 call to apachesolr_multilingual_confgen_modify_solrconfig()
apachesolr_multilingual_confgen_apachesolr_confgen_solrconfig_alter in apachesolr_multilingual_confgen/apachesolr_multilingual_confgen.module
Implements hook_apachesolr_confgen_solrconfig_alter().

File

apachesolr_multilingual_confgen/apachesolr_multilingual_confgen.generator.inc, line 295
Schema generator for multilingual search

Code

function apachesolr_multilingual_confgen_modify_solrconfig($qp_solrconfig, $solr_version) {
  foreach (apachesolr_multilingual_language_list() as $language_id => $language) {
    $qp_solrconfig_language_specific = apachesolr_confgen_clone_qp($qp_solrconfig);
    $spellcheck = $qp_solrconfig_language_specific
      ->find(':root searchComponent[name="spellcheck"]')
      ->attr('name', 'spellcheck_' . $language_id);
    $query_analyzer_field_type = $spellcheck
      ->branch()
      ->find('str[name="queryAnalyzerFieldType"]');
    $query_analyzer_field_type
      ->text($query_analyzer_field_type
      ->text() . '_' . $language_id);
    $fields = $spellcheck
      ->branch()
      ->find('str[name="field"]');
    foreach ($fields as $field) {
      $field
        ->text('i18n_spell_' . $language_id);
    }
    $spellcheck_index_dirs = $spellcheck
      ->branch()
      ->find('str[name="spellcheckIndexDir"]');
    foreach ($spellcheck_index_dirs as $spellcheck_index_dir) {
      $spellcheck_index_dir
        ->text($spellcheck_index_dir
        ->text() . '_' . $language_id);
    }
    $spellcheck
      ->insertBefore($qp_solrconfig
      ->find(':root searchComponent[name="spellcheck"]'));
    $qp_solrconfig
      ->find(':root requestHandler[default="true"] arr[name="last-components"] str:last-child')
      ->before('<str>spellcheck_' . $language_id . '</str>');
  }
}