ブラウザの履歴を全文検索する

このへん を見て、そういえば WWWOFFLE と HyperEstraier を連携させるなんてネタがあったなぁ、と思ったので、Debian lenny に適当に設定してみた。

/dev/random の修正

coLinux はなんか /dev/random がよくないらしく、WWWOFFLE の鍵生成でとまってしまうので、/dev/random を /dev/urandom と同じものにしておく。

% sudo rm /dev/random
% sudo mknod /dev/random c 1 9

coLinux で無い場合はやらなくていい。多分。
ちなみにこの問題にたどり着くために strace/ltrace が役に立った。時代は機械語より strace だ(しつこい)。

パッケージのインストール

まぁ、普通にインストール。

% sudo aptitude install hyperestraier
% sudo aptitude install wwwoffle

Apache HTTPD が入っていない人は入れておく。

% sudo aptitude install apache2

WWWOFFLE の設定

localhost 以外から接続する場合は /etc/wwwoffle/wwwoffle.conf の AllowedConnectHosts 辺りをいじる。coLinux な人はこんな感じ。

AllowedConnectHosts
{
    192.168.1.1
}

インデキシングの設定

crontab にインデキシングのコマンドを追加する。

% sudo env EDITOR=vi crontab -e
0 * * * * * /var/cache/wwwoffle/search/hyperestraier/scripts/wwwoffle-estcmd-full

検索用 CGI を追加

/usr/lib/estraier 以下に検索用 CGI が入っているのでそれを使えるようにする。

% sudo ln -s ../lib/est{seek,proxy}.cgi /usr/lib/cgi-bin
% sudo cp /usr/share/hyperestraier/est{seek,proxy}.conf /usr/lib/cgi-bin

estseek.conf を設定。

indexname: /var/cache/wwwoffle/search/hyperestraier/db

tmplfile: /usr/share/hyperestraier/estseek.tmpl

topfile: /usr/share/hyperestraier/estseek.top

helpfile: /usr/share/hyperestraier/estseek.help

dispproxy: estproxy.cgi

あとはブラウザの proxy を localhost:8080 に設定すれば見たページが1時間ごとにインデックスされていく。検索は http://localhost/cgi-bin/estseek.cgi で。