| トップ | Solaris | FreeBSD | Gentoo | CentOS | Fedora | Windows | Tips | 自宅サーバの動作確認 | サイト内検索(Namazu) | サイト内検索(HE) |
「Estraier」の後継である「Hyper Estraier」を導入する。
ここでは
/var/www/html/
以下のすべてを検索対象ディレクトリとし、インデックスを
/var/www/hyperestraier/
に作成するものとする。
なお、「Apache」の設定は完了済みとする。
「Hyper Estraier」のインストール
[root@Fedora ~]# yum -y install hyperestraier <= 「Hyper Estraier」のインストール |
インデックス格納先ディレクトリの作成
[root@Fedora ~]# mkdir /var/www/hyperestraier |
「Hyper Estraier」の新規実行
「Hyper Estraier」を新規に実行する場合は以下のようにする。
[root@Fedora ~]# estcmd gather -il ja -bc -sd /var/www/hyperestraier/crimson-snow /var/www/html <= 文書の登録 [root@Fedora ~]# estcmd create -attr @title str -attr @mdate seq -attr @size seq /var/www/hyperestraier/crimson-snow <= 属性名とデータ型を指定 |
「Hyper Estraier」の実行
ページに更新があった後、「Hyper Estraier」を実行する場合は以下のようにする。
[root@Fedora ~]# estcmd gather -cl -il ja -bc -sd -cm /var/www/hyperestraier/crimson-snow /var/www/html <= 文書の登録 [root@Fedora ~]# estcmd create -attr @title str -attr @mdate seq -attr @size seq /var/www/hyperestraier/crimson-snow <= 属性名とデータ型を指定 [root@Fedora ~]# estcmd purge -cl /var/www/hyperestraier/crimson-snow <= 削除文書の反映 [root@Fedora ~]# estcmd optimize /var/www/hyperestraier/crimson-snow <= インデックスの最適化 |
設定ファイル等格納先ディレクトリの作成
[root@Fedora ~]# mkdir /var/www/cgi-bin/hyperestraier |
各種ファイルのコピー
[root@Fedora ~]# cp /usr/libexec/estseek.cgi /var/www/cgi-bin/hyperestraier/estseek.cgi [root@Fedora ~]# cp /usr/share/hyperestraier/locale/ja/estseek.conf /var/www/cgi-bin/hyperestraier/estseek.conf [root@Fedora ~]# cp /usr/share/hyperestraier/locale/ja/estseek.tmpl /var/www/cgi-bin/hyperestraier/estseek.tmpl [root@Fedora ~]# cp /usr/share/hyperestraier/locale/ja/estseek.top /var/www/cgi-bin/hyperestraier/estseek.top [root@Fedora ~]# cp /usr/share/hyperestraier/locale/ja/estseek.help /var/www/cgi-bin/hyperestraier/estseek.help |
「Hyper Estraier」の設定
[root@Fedora ~]# vi /var/www/cgi-bin/hyperestraier/estseek.conf <= 設定ファイルの編集
indexname: casket
↓
indexname: /var/www/hyperestraier/crimson-snow <= インデックスを指定
replace: ^file:///home/mikio/public_html/{{!}}http://localhost/
↓
replace: ^file:///var/www/html/{{!}}http://www.crimson-snow.net/ <= 検索対象ディレクトリの置換
formtype: normal
↓
formtype: web <= 入力フォームの種類をWebサイト用にする
|
ブラウザで
http://サーバのIPアドレス/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="UTF-8" />
</DIV>
</FORM>
|
[root@Fedora ~]# vi /root/hyperestraier.sh <= 文書の登録&インデックスの更新スクリプト作成 #!/bin/sh ESTCMD='/usr/bin/estcmd' $ESTCMD gather -cl -il ja -bc -sd -cm /var/www/hyperestraier/crimson-snow /var/www/html > /dev/null 2>&1 $ESTCMD create -attr @title str -attr @mdate seq -attr @size seq /var/www/hyperestraier/crimson-snow > /dev/null 2>&1 [root@Fedora ~]# chmod 744 /root/hyperestraier.sh <= 作成したスクリプトに実行権限付加 |
スクリプトの自動実行
[root@Fedora ~]# crontab -e <= 設定ファイルの編集 00 03 * * * /root/hyperestraier.sh <= 追加(毎日3:00にスクリプト実行) 10 03 * * 1 /usr/bin/estcmd purge -cl /var/www/hyperestraier/crimson-snow > /dev/null 2>&1 <= 追加(毎週月曜日に削除文書の反映) 30 03 1 * * /usr/bin/estcmd optimize /var/www/hyperestraier/crimson-snow > /dev/null 2>&1 <= 追加(毎月1回インデックスの最適化) |