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