-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch_api_solr_nlp.install
62 lines (53 loc) · 2.38 KB
/
search_api_solr_nlp.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
use Drupal\Component\Serialization\Yaml;
/**
* Add lower case filter to German field types.
*/
function search_api_solr_nlp_update_8001() {
\Drupal::moduleHandler()->loadInclude('search_api_solr', 'install');
foreach (['nouns' => 'nouns', 'edge_nouns' => 'edgenouns'] as $custom_code => $wrong_custom_code) {
$filename = __DIR__ . '/config/optional/search_api_solr.solr_field_type.text_' . $custom_code . '_de_7_0_0.yml';
$config = Yaml::decode(file_get_contents($filename));
foreach (search_api_solr_update_helper_get_field_type_configs() as $field_type_name => $field_type_config) {
if ('search_api_solr.solr_field_type.text_' . $custom_code . '_de_7_0_0' === $field_type_name) {
search_api_solr_update_helper_save_field_type_config($field_type_name, ['uuid' => $field_type_config['uuid']] + $config);
break;
}
if ('search_api_solr.solr_field_type.text_' . $wrong_custom_code . '_de_7_0_0' === $field_type_name) {
\Drupal::configFactory()->getEditable($field_type_name)->delete();
search_api_solr_update_helper_install_configs();
break;
}
}
}
}
/**
* Apply synonyms at query time.
*/
function search_api_solr_nlp_update_8002() {
// Moved to search_api_solr_nlp_update_8003().
}
/**
* Fix tokenizer configs.
*/
function search_api_solr_nlp_update_8003() {
// Moved to search_api_solr_nlp_update_8004().
}
/**
* Enforce module dependencies.
*/
function search_api_solr_nlp_update_8004() {
\Drupal::moduleHandler()->loadInclude('search_api_solr', 'install');
foreach (search_api_solr_update_helper_get_field_type_configs() as $field_type_name => $field_type_config) {
if (in_array($field_type_config['custom_code'], ['nouns', 'edge_nouns'])) {
$filename = __DIR__ . '/config/optional/search_api_solr.solr_field_type.text_' . $field_type_config['custom_code'] . '_' . $field_type_config['field_type_language_code'] .'_7_0_0.yml';
if (!file_exists($filename)) {
$filename = __DIR__ . '/config/install/search_api_solr.solr_field_type.text_' . $field_type_config['custom_code'] . '_' . $field_type_config['field_type_language_code'] . '_7_0_0.yml';
}
if (file_exists($filename)) {
$config = Yaml::decode(file_get_contents($filename));
search_api_solr_update_helper_save_field_type_config($field_type_name, ['uuid' => $field_type_config['uuid']] + $config);
}
}
}
}