mattermostで日本語検索
やること
mattermostで日本語検索をできるようにする。
環境
- CentOS 7.2
- PostgreSQL 9.2
手順
基本的な手順はここにかいてある通り。 https://docs.mattermost.com/install/i18n.html#japanese
この手順をコピペしてもパスがちょっと違ったりしてうまくできない。 CentOS用に以下のように読み替える。
Install necessary packages:
postgresql-develもインストールする。
sudo yum install git gcc-c++ postgresql-devel
Intall Mecab and Mecab IPA-dictionary:
prefixは指定しない。指定しておけば、色々混ざらないようにできるが、面倒なのでやらない。
mkdir ~/tmp cd ~/tmp git clone https://github.com/taku910/mecab.git cd mecab/mecab/ ./configure make sudo make install
cd ~/tmp/mecab/mecab-ipadic/ ./configure --with-charset=utf8 make sudo make install
ライブラリのパスに/usr/local/libを追加する。
su - echo /usr/local/lib > /etc/ld.so.conf.d/usr-local-x86_64.conf ldconfig exit
Install textsearch_ja:
pg_configへのパスは指定しない。
cd ~/tmp git clone https://github.com/oknj/textsearch_ja.git cd textsearch_ja make USE_PGXS=1 sudo make USE_PGXS=1 install
Enable pg_catalog.japanese:
extensionを作るのはpostgresで。
sudo su - postgres psql > create extension if not exists textsearch_ja; > \q
Install pg_bigm:
cd ~/tmp curl -L -O https://osdn.jp/projects/pgbigm/downloads/63792/pg_bigm-1.1-20150910.tar.gz tar zxvf pg_bigm-1.1-20150910.tar.gz cd pg_bigm-1.1-20150910 make USE_PGXS=1 sudo make USE_PGXS=1 install
Re-create index using pg_bigm:
pg_configへのパスは指定しない。 extensionを作るのはpostgresで。 indexの作り直しはmmuserで。(mmuser)はmattermost用のユーザ。
su - postgres psql > create extension if not exists pg_bigm; > \q psql --user mmuser --password mattermost > drop index idx_posts_message_txt; > create index idx_posts_message_txt on posts using gin (message gin_bigm_ops); > \q exit