textsearch-ja

9.0はこちら → PostgreSQL 9.0 textsearch-ja 9.0.0 - external storage

http://textsearch-ja.projects.postgresql.org/textsearch_ja.html#install

postgres インストール

# cd /usr/ports/databases/postgresql84-server/
(後でソースを使うのでcleanしない)
# make install
# vi /etc/rc.conf
====
postgresql_enable="YES"
====
# /usr/local/etc/rc.d/postgresql initdb
# /usr/local/etc/rc.d/postgresql start

mecab インストール

# cd /usr/ports/japanese/mecab
# make WITH_CHARSET=utf-8 install
# cd /usr/ports/japanese/mecab-ipadic
# sudo make WITH_CHARSET=utf-8 install clean

textsearch-ja インストール

# cd /usr/ports/databases/postgresql84-server/work/postgresql-8.4.5/contrib/
# wget http://pgfoundry.org/frs/download.php/2287/textsearch_ja-8.4.2.tar.gz
# tar xvzf textsearch_ja-8.4.2.tar.gz
# cd textsearch_ja-8.4.2
# vi Makefile
====
SHLIB_LINK = -lmecab

SHLIB_LINK = -lmecab -lpthread
==== ★1
# gmake
# gmake install

確認

$ createdb -U pgsql -E UTF8 -T template0 test
$ psql -U pgsql -f /usr/ports/databases/postgresql84-server/work/postgresql-8.4.5/contrib/textsearch_ja-8.4.2/textsearch_ja.sql test
$ psql -U pgsql -f /usr/ports/databases/postgresql84-server/work/postgresql-8.4.5/contrib/textsearch_ja-8.4.2/sql/textsearch_ja.sql test

★1 -lpthread がないとインストールで以下のエラー

$ psql -U pgsql -f /usr/ports/databases/postgresql84-server/work/postgresql-8.4.5/contrib/textsearch_ja-8.4.2/textsearch_ja.sql test
SET
BEGIN
psql:textsearch_ja.sql:12: ERROR: could not load library "/usr/local/pgsql/lib/textsearch_ja.so": dlopen (/usr/local/pgsql/lib/textsearch_ja.so) failed: /usr/local/lib/libmecab.so.1: Undefined symbol "pthread_create"