編集の要約なし
(→関連項目) |
編集の要約なし |
||
10行目: | 10行目: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
vi /etc/yum.repos.d/elasticsearch.repo | vi /etc/yum.repos.d/elasticsearch.repo | ||
[elasticsearch-6.x] | |||
name=Elasticsearch repository for 6.x packages | |||
baseurl=https://artifacts.elastic.co/packages/6.x/yum | |||
gpgcheck=1 | |||
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch | |||
enabled=0 | |||
autorefresh=0 | |||
type=rpm-md | |||
[elasticsearch-5.x] | |||
name=Elasticsearch repository for 5.x packages | |||
baseurl=https://artifacts.elastic.co/packages/5.x/yum | |||
gpgcheck=1 | |||
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch | |||
enabled=1 | |||
autorefresh=1 | |||
type=rpm-md | |||
[elasticsearch-2.x] | [elasticsearch-2.x] | ||
19行目: | 36行目: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
上記は、Elasticsearch 2. | 上記は、Elasticsearch 2.xをインストールする場合の例。現在、MediawikiのExtensionは1.28系が2.x以下をサポートし、1.29系は5.x以上をサポートしている。利用しているExtensionのバージョンとElasticsearchのバージョンを合わせる必要がある。 | ||
*yumを利用したインストール | *yumを利用したインストール | ||
48行目: | 54行目: | ||
*Kuromojiのインストール | *Kuromojiのインストール | ||
Elasticsearch | Elasticsearch 2.xの場合 | ||
<syntaxhighlight lang="bash"> | |||
cd /usr/share/elasticsearch/ | |||
bin/plugin install analysis-kuromoji | |||
</syntaxhighlight> | |||
Elasticsearch 5.xの場合 | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
cd /usr/share/elasticsearch/ | cd /usr/share/elasticsearch/ | ||
bin/plugin install | bin/elasticsearch-plugin install analysis-kuromoji | ||
</syntaxhighlight> | </syntaxhighlight> | ||
95行目: | 107行目: | ||
*analyzer設定の変更 | *analyzer設定の変更 | ||
:src/elasticsearch/Indexer.phpの'analyzer' => 'english'を'kuromoji'へ変更する。この変更はプラグインがバージョンアップされたらリセットされるため注意が必要。 | :src/elasticsearch/Indexer.phpの'analyzer' => 'english'を'kuromoji'へ変更する。この変更はプラグインがバージョンアップされたらリセットされるため注意が必要。 | ||
<syntaxhighlight lang="bash"> | |||
if($props['type'] == 'string' && $props['index'] == 'analyzed'){ | |||
$lang = Config::apply_filters('string_language', 'english'); | |||
$props = array( | |||
'type' => 'multi_field', | |||
'fields' => array( | |||
$field => $props, | |||
$lang => array_merge($props,array( | |||
'analyzer' => 'kuromoji' /* $lang から'kuromoji'へ変更 */ | |||
) | |||
) | |||
) | |||
); | |||
} | |||
</syntaxhighlight> | |||
Fantastic Elasticsearchが古いバージョンの場合 | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
if($props['type'] == 'string' && $props['index'] == 'analyzed'){ | if($props['type'] == 'string' && $props['index'] == 'analyzed'){ | ||
102行目: | 131行目: | ||
$field => $props, | $field => $props, | ||
'english' => array_merge($props,array( | 'english' => array_merge($props,array( | ||
'analyzer' => 'kuromoji' | 'analyzer' => 'kuromoji' /* 'english'から'kuromoji'へ変更 */ | ||
) | ) | ||
) | ) |