Namazu 2.0 入門
 本文書の目的
 2.0.12 版
 簡単・組立済
  NetBSD/pkgsrc
  FreeBSD/Ports
  RedHat Linux/RPM
  Debian
  MacOS X
お急ぎのあなたに
  準備
  configure, make
  make install
  動作確認
始める前に
 mknmz と namazu(.cgi)
 make に必要なもの
 upgrade 更新
  索引の互換性
mknmz
 configure と make
  File-MMagic
  ./configure, make
  make check
 make install 前に
 make install
 --help の表示
 動作確認 mknmz
 URL を合わせる
  --replace
  .namazurc(Replace)
 検索を作る対象
  ~/.mknmzrc での設定
  操作行での指定
 ~/.mknmzrc
  1. 書き方
  2. 位置
  3. .mknmzrc 内変数
 新規と更新
 Filter(前処理)
 各種文書形式
 EXCLUDE_PATH
  最初に | は不可
namazu
 .namazurc
 動作確認
 namazu.cgi
 日本語処理
 環境変数の設定
 --indexing-lang 引数
  環境変数
  日本語表示
  日本語の文字を変える
 型紙(template)のこと
  参照指定 (mknmz)
  参照指定 (namazurc)
  型紙図示
応用編
 項目(field)検索
 複数索引
 窓を付ける
 日記
 Wanderlust
 mhonarc
 表示を自分用に変更
 検索結果の画面を変更
用語
 索引
 kakasi(他)
参照 (URL's)
 他の方の TIPS
その他
 Namazu で出来ること
 出来ないこと
 歴史など
 資源について(準備中)
  最大インデックス
  Out of memory!
  Benchmark
 dbname -> idxname
 チェックポイント機構
 同じ文章を検索対象から外す
 更なる情報源
 うまく行かない
  設置が正しく
  設定
  参照されているか
  索引すべき譜はありません
  FAQ
  情報検索
  バグ追跡システム
  文字化け
 Namazu 採用地点
  番外
  私家版修正
 質問の仕方
  自分の環境を伝えるには
 被参照地点
  UTF-8

Software 入口 | Hardware | NetBSD 解説 | packages | macppc | TsubaiBSD 絹/software/全文検索

URL を合わせる

URL を合わせる(URL 置換の)方法は二通りある。

【何故必要か】
mknmz は通常、自分の計算機の path の名前で仕事をする。 しかしそれを cgi-bin から参照する場合には、 http://... となって欲しいはずで、 mknmz から見えるいる譜の名前と、 namazu.cgi の時に指定する URL での名前は違っているのが普通である。 例えば、~/public_html の索引を /tmp/index に作ろうとして 次のようにすると、

makoto@milano ■20:55:02/001014(~/public_html)> mkdir /tmp/index
makoto@milano ■20:55:02/001014(~/public_html)> mknmz -O /tmp/index .
Reading .mknmzrc
Looking for indexing files...
146 files are found to be indexed.
1/146 - /export/home/makoto/public_html/LV/index.html [text/html]
2/146 - /export/home/makoto/public_html/Small-Circle/form-j.html [text/html]
3/146 - /export/home/makoto/public_html/Small-Circle/ [text/html]
4/146 - /export/home/makoto/public_html/diary/anti-windoze/README [text/plain]
5/146 - /export/home/makoto/public_html/diary/anti-windoze/theme.ph [text/plain]
のような表示がされて、たとへばその中の赤で示した
3/146 - /export/home/makoto/public_html/Small-Circle/ [text/html]
という字は 本当は、
3/146 - http://hostname.domain/~makoto/Small-Circle/ [text/html]
となって欲しいところである。ではそれにはどうすればいいかを次に説明する。

【Replace・二つの方法】
このために用意されている機能が replace で、これは mknmz にも namazu にもある。そのどちらかを使へばいいが、namazu の方 で合わせるのがおすすめである。しかし 実行順に従って、 mknmz の方から説明する。

--replace

mknmz の方で合せるには、操作行で --replace 's#何々#これこれ#' のように、つまり、
makoto@milano ■21:06:41/001014(~/public_html)> \
mknmz -O /tmp/index \
--replace 's#/export/home##;\
           s#/([^/]+)/public_html#~$1#;\
           s#^#http://hostname.domain/#' .
Reading .mknmzrc
Looking for indexing files...
146 files are found to be indexed.
1/146 - http://hostname.domain/~makoto/LV/index.html [text/html]
2/146 - http://hostname.domain/~makoto/Small-Circle/form-j.html [text/html]
3/146 - http://hostname.domain/~makoto/Small-Circle/ [text/html]
4/146 - http://hostname.domain/~makoto/diary/anti-windoze/README [text/plain]
などとやる。ちょっと分りにくいが、--replace の次の '...' の中に s#元々#変更後# という形式を三つ書いて ; でつないでいる。 (上の例では \ は shell の継続行を示す)
--replace ' ' の ' ' で囲まれた部分 は Perl 語で書く。

.namazurc(Replace)

.namazurc の方の場合で設定する場合には、例えば mknmz の方では何も 調整しないでおいて、 .namazurc に
LANG ja
INDEX /tmp/index
Replace  /export/home/makoto/public_html http://hostname.domain/~makoto
(この中で初めの二行は Replace とは直接は関係ない。)
と書いておくと、次のように目的の URL が表示される。
makoto@milano ■21:31:10/001014(~/public_html)> namazu small-circle

検索結果

参考ヒット数:  [ small-circle: 1 ] 

検索式にマッチする 1 個の文書が見つかりました。

1. Writing HTML document at ki.nu (score: 4)
Author: 不明
Date: Sun, 18 Oct 1998 14:32:03
いろいろ Counter Small-Circle | 
(2) 参考
http://www.gsp.com/support/contrib/wwwcount/Count.html#digs 
いろいろな見本(例が豊富なので是非一見) http://www.gsp.com/support/contrib/wwwcount/Count2_4-ex.ht
http://hostname.domain/~makoto/Small-Circle/ (2,614 bytes)
検索

この画面は jeedosaquin を使って表示している。

Last Update: Wed, 23 Apr 2008 06:33:00 GMT 1.1.1.1 2008/03/12