Commit a7e6b9de authored by git's avatar git Committed by Markus Kalkbrenner
Browse files

Issue #3048751 by OanaIlea, gnindl, mkalkbrenner: Ukrainian lemmatization

parent 41f30be6
Loading
Loading
Loading
Loading
+4 −6
Changes for config/optional/search_api_solr.solr_field_type.text_uk_6_0_0.yml: 4 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -39,9 +39,8 @@ field_type:
          ignoreCase: true
          words: stopwords_uk.txt
        -
          class: solr.SnowballPorterFilterFactory
          language: Russian
          protected: protwords_uk.txt
          class: solr.MorphologikFilterFactory
          dictionary: ukrainian.dict
        -
          class: solr.RemoveDuplicatesTokenFilterFactory
    -
@@ -71,9 +70,8 @@ field_type:
          ignoreCase: true
          words: stopwords_uk.txt
        -
          class: solr.SnowballPorterFilterFactory
          language: Russian
          protected: protwords_uk.txt
          class: solr.MorphologikFilterFactory
          dictionary: ukrainian.dict
        -
          class: solr.RemoveDuplicatesTokenFilterFactory
unstemmed_field_type:
+4 −6
Changes for config/optional/search_api_solr.solr_field_type.text_uk_7_0_0.yml: 4 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -39,9 +39,8 @@ field_type:
          ignoreCase: true
          words: stopwords_uk.txt
        -
          class: solr.SnowballPorterFilterFactory
          language: Russian
          protected: protwords_uk.txt
          class: solr.MorphologikFilterFactory
          dictionary: ukrainian.dict
        -
          class: solr.RemoveDuplicatesTokenFilterFactory
    -
@@ -71,9 +70,8 @@ field_type:
          ignoreCase: true
          words: stopwords_uk.txt
        -
          class: solr.SnowballPorterFilterFactory
          language: Russian
          protected: protwords_uk.txt
          class: solr.MorphologikFilterFactory
          dictionary: ukrainian.dict
        -
          class: solr.RemoveDuplicatesTokenFilterFactory
unstemmed_field_type:
+1 −1
Changes for config/schema/solr_field_type.schema.yml: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -246,7 +246,7 @@ search_api_solr.solr_field_type_filters:
        nullable: true
      dictionary:
        type: string
        label: 'OpenNLPLemmatizerFilter:: HunspellStemFilter:: DictionaryCompoundWordTokenFilter::dictionary'
        label: 'OpenNLPLemmatizerFilter:: HunspellStemFilter:: MorphologikFilterFactory:: DictionaryCompoundWordTokenFilter::dictionary'
        nullable: true
      lemmatizerModel:
        type: string
+29 −0
Changes for search_api_solr.install: 29 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -1199,3 +1199,32 @@ function search_api_solr_update_8315() {
    }
  }
}

/**
 * Use Ukrainian lemmatization instead of Russian SnowballPorterFilterFactory.
 */
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']) {
      if (!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.MorphologikFilterFactory';
                    unset($filter['language']);
                    unset($filter['protected']);
                    $filter['dictionary'] = 'ukrainian.dict';
                  }
                }
              }
            }
          }
        }
        search_api_solr_update_helper_save_field_type_config($field_type_name, $field_type_config);
      }
    }
  }
}