| トップ | Solaris | FreeBSD | Gentoo | CentOS | Fedora | Windows | Tips | 自宅サーバの動作確認 | サイト内検索(Namazu) | サイト内検索(HE) |
「Estraier」の後継である「Hyper Estraier」を導入する。
ここでは
/usr/local/www/data-dist/
以下のすべてを検索対象ディレクトリとし、インデックスを
/usr/local/www/hyperestraier/
に作成するものとする。
なお、「Apache」の設定は完了済みとする。
FreeBSD# cd /usr/ports/textproc/hyperestraier <= 作業ディレクトリへ移動 FreeBSD# make install clean <= 「Hyper Estraier」のインストール |
インデックス格納先ディレクトリの作成
FreeBSD# mkdir /usr/local/www/hyperestraier |
「Hyper Estraier」の新規実行
「Hyper Estraier」を新規に実行する場合は以下のようにする。
FreeBSD# estcmd gather -il ja -bc -sd /usr/local/www/hyperestraier/crimson-snow /usr/local/www/data-dist <= 文書の登録 FreeBSD# estcmd create -attr @title str -attr @mdate seq -attr @size seq /usr/local/www/hyperestraier/crimson-snow <= 属性名とデータ型を指定 |
「Hyper Estraier」の実行
ページに更新があった後、「Hyper Estraier」を実行する場合は以下のようにする。
FreeBSD# estcmd gather -cl -il ja -bc -sd -cm /usr/local/www/hyperestraier/crimson-snow /usr/local/www/data-dist <= 文書の登録 FreeBSD# estcmd create -attr @title str -attr @mdate seq -attr @size seq /usr/local/www/hyperestraier/crimson-snow <= 属性名とデータ型を指定 FreeBSD# estcmd purge -cl /usr/local/www/hyperestraier/crimson-snow <= 削除文書の反映 FreeBSD# estcmd optimize /usr/local/www/hyperestraier/crimson-snow <= インデックスの最適化 |
設定ファイル等格納先ディレクトリの作成
FreeBSD# mkdir /usr/local/www/cgi-bin/hyperestraier |
各種ファイルのコピー
FreeBSD# cp /usr/local/libexec/estseek.cgi /usr/local/www/cgi-bin/hyperestraier/ FreeBSD# cp /usr/local/share/hyperestraier/locale/ja/estseek.conf /usr/local/www/cgi-bin/hyperestraier/ FreeBSD# cp /usr/local/share/hyperestraier/locale/ja/estseek.tmpl /usr/local/www/cgi-bin/hyperestraier/ FreeBSD# cp /usr/local/share/hyperestraier/locale/ja/estseek.top /usr/local/www/cgi-bin/hyperestraier/ |
「Hyper Estraier」の設定
FreeBSD# vi /usr/local/www/cgi-bin/hyperestraier/estseek.conf <= 設定ファイルの編集
indexname: casket
↓
indexname: /usr/local/www/hyperestraier/crimson-snow <= インデックスを指定
replace: ^file:///home/mikio/public_html/{{!}}http://localhost/
↓
replace: ^file:///usr/local/www/data-dist/{{!}}http://www.crimson-snow.net/ <= 検索対象ディレクトリの置換
formtype: web <= 追加(入力フォームの種類をWebサイト用にする)
|
ブラウザで
http://www.crimson-snow.net/cgi-bin/hyperestraier/estseek.cgi
とアクセスする。
サイト内に設置する場合
サイト内に検索用のFORMを設置する場合、設置したい場所に以下の内容を記述。
<FORM method="get" action="/cgi-bin/hyperestraier/estseek.cgi">
<DIV>
<INPUT type="text" name="phrase" value="" size="32" tabindex="1" />
<INPUT type="submit" value="Search" tabindex="2" />
<INPUT type="hidden" name="enc" value="EUC-JP" />
</DIV>
</FORM>
|
FreeBSD# vi /root/hyperestraier.sh <= 転置インデックスの自動作成&不要データ削除スクリプト作成 #!/bin/sh ESTCMD='/usr/local/bin/estcmd' $ESTCMD gather -cl -il ja -bc -sd -cm /usr/local/www/hyperestraier/crimson-snow /usr/local/www/data-dist > /dev/null 2>&1 $ESTCMD create -attr @title str -attr @mdate seq -attr @size seq /usr/local/www/hyperestraier/crimson-snow > /dev/null 2>&1 FreeBSD# chmod 744 /root/hyperestraier.sh <= 作成したスクリプトに実行権限付加 |
スクリプトの自動実行
FreeBSD# vi /etc/crontab <= cronの編集 00 03 * * * /root/hyperestraier.sh <= 追加(毎日3:00にスクリプト実行) 10 03 * * 1 /usr/local/bin/estcmd purge -cl /usr/local/www/hyperestraier/crimson-snow > /dev/null 2>&1 <= 追加(毎週月曜日に削除文書の反映) 30 03 1 * * /usr/local/bin/estcmd optimize /usr/local/www/hyperestraier/crimson-snow > /dev/null 2>&1 <= 追加(毎月1回インデックスの最適化) |