Crowiに検索機能を追加する方法


Crowiに検索機能が欲しくなったため、構築済のCrowi1.6に機能を追加する。

検証環境

  • CentOS 7.4 x64 (Minimal Install)
  • Crowi 1.6.2

Crowiのセットアップ方法は以下の記事を参照
https://qiita.com/SkyLaptor/items/f5de5f8528da277abd8f

セットアップに必要なモジュールのインストール

# yum install java-1.8.0-openjdk
# rpm -qa | grep java-
java-1.8.0-openjdk-headless-1.8.0.144-0.b01.el7_4.x86_64
java-1.8.0-openjdk-1.8.0.144-0.b01.el7_4.x86_64

Elasticsearchのインストール

# vi /etc/yum.repos.d/elasticsearch.repo
# yum install elasticsearch
# rpm -qa | grep elasticsearch
elasticsearch-5.6.1-1.noarch
# cd /usr/share/elasticsearch
# bin/elasticsearch-plugin install analysis-kuromoji
# systemctl start elasticsearch
# systemctl enable elasticsearch
elasticsearch.repo
[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

参考: https://www.elastic.co/guide/en/elasticsearch/plugins/current/installation.html

Crowiの設定変更

# vi /etc/sysconfig/crowi
# systemctl restart crowi
/etc/sysconfig/crowi
# 追記
ELASTICSEARCH_URI="http://localhost:9200"

検索機能の動作確認

Crowiにアクセスし、検索機能が追加されていることを確認する。

なぜかInternetExplorerでは表示されない。ChromeとFirefoxは問題なし。

参考

https://qiita.com/bezeklik/items/48fe054c2df05f03f3d1
https://qiita.com/oshuya/items/05883de5cc275d87a7b8