アクセスカウンターについて フォームとCGI目次 HTTP Cookies

WAISサーバとのゲートウェイ

WAISは文書検索サービスを提供する上で非常に強力なツールであり、コマーシャルなサーバとフリーで利用できるサーバとが存在します。ここではフリーなWAISサーバを利用し、WWWとのゲートウェイを作る方法をご紹介します。

WAISサーバの種類

まず、WAIS社のコマーシャル版を除いて、フリーの代表的なWAISサーバにはfreeWAISと、その強化版freeWAIS-sfがあります。

WAIS-WWWゲートウェイの種類

WAISサーバとWWWのやりとりを行うツールは数多く作られている中で、代表的なゲートウェイ・プログラム(CGI)は次のとおりです。
SFgate
freeWAIS-sfとのゲートウェイプログラム(CGI)
WWWWAIS
EIT社で開発されたWAISサーバとのゲートウェイプログラム(CGI)
Son of WAIS.pl
Michael Gradyによって開発されたWAISサーバとのゲートウェイプログラム(CGI)
以下はWAISサーバへfreeWAIS-sfを、ゲートウェイへwwwwaisを使用してインストールした例です。

freeWAIS-sfサーバのコンパイルとインデックスの作成

freeWAIS-sfは下記から入手可能です。

ftp.germany.eu.net:/pub/infosystems/wais/Unido-LS6/
ftp://ftp.lab.kdd.co.jp/infosystems/freeWAIS-sf/

解凍後、Configureプログラムを実行し、コンパイル(make)、インストール(make install)を行ってから、文書のインデックスを作成します。RFCをインデックス化した記述例は次のとおりです。

RFC文書の場所
/usr/local/etc/httpd/htdocs/RFC/
WAISインデックスの場所
/var/spool/wais/
インデックス名
rfc
と考えた場合、
	
	
	# cd /var/spool/wais
	# waisindex -d rfc -r /usr/local/etc/httpd/htdocs/RFC
	
	
そして、WAISサーバを起動します。
	
	
	# waisserver -p 210 -u wais -e /var/log/wais/wais.log -d /var/spool/wais
	
	

WWWWAISのインストール

wwwwaisは下記から入手可能です。

http://www.eit.com/software/wwwwais/wwwwais.html
ftp://ftp.lab.kdd.co.jp/infosystems/wwwwais/

conffileの定義を変更後、以下のようにコンパイルし、cgi-binへインストールします。

	
	
	# cc -O -o wwwwais wwwwais.25.c
	# cp wwwwais $cgi-bin
	
	
続いてwwwwais.conf内の項目を変更します。
SelfURL
wwwwaisのフルURL名
MaxHits
最大ヒット数
AddrMask
アクセス制限をする場合に設定する。
WaisqBin
waisq コマンドのパス名
WaissearchBin
waissearch コマンドのパス名
SwishBin
swish コマンドのパス名
WaisSource
参照するドキュメントインデックスのソースファイル
	
	
	WaisSource /var/spool/wais/rfc/src "RFC"
	
	
SourceRules
書類のパスを変更する場合に指定します。

replace:
  書類パスを変更します。これを使用すればwaisindexの-tオプションは不要です。

	
	
	SourceRules replace "/usr/local/etc/httpd/htdocs/" "/"
	
	
prepend:
  パス名やURLの前に加えます。下記の場合、書類を表示する際、
  「http://www.yokochin.com/cgi-bin/print_hit_bold.pl」が前に加えられます。
  print_hit_bold.plは"?$keywords#first_hit"組み合わせて、検索キーを<b>タグで
  ボールド体にします。
	
	
	SourceRules prepend "http://www.yokochin.com/cgi-bin/print_hit_bold.pl"
	
	
append:
  パス名やURLの後に加えます。
	
	
	SourceRules append "?$keywords#first_hit"
	
	
IconUrl
アイコンイメージのURL
これで、http://www.yokochin.com/cgi-bin/wwwwaisでWAISゲートウェイが実行できます。また、wwwwais.25.cを変更し、最大ヒット数、ソートタイプを指定できるように変更できます。
	
	
	*** wwwwais.25.c	Mon Feb 12 14:38:26 1996
	--- wwwwais.251e.c	Mon Feb 12 17:16:44 1996
	***************
	*** 1119,1132 ****
				selection)) ? " selected" : "", sourcelist->line);
				sourcelist = sourcelist->next;
			}
	!		printf("</select>\n<p>\n");
		}
		printf("<input type=hidden name=message value=\"%s\">\n",
		"If you can see this, then your browser can't support hidden fields.");
		printf("<input type=hidden name=source value=\"%s\">\n", source);
		printf("<input type=hidden name=sourcedir value=\"%s\">\n", sourcedir);
	-	printf("<input type=hidden name=maxhits value=\"%s\">\n", maxhits);
	-	printf("<input type=hidden name=sorttype value=\"%s\">\n", sorttype);
		printf("<input type=hidden name=host value=\"%s\">\n", host);
		printf("<input type=hidden name=port value=\"%s\">\n", port);
		printf("<input type=hidden name=searchprog value=\"%s\">\n",
	--- 1119,1148 ----
				selection)) ? " selected" : "", sourcelist->line);
				sourcelist = sourcelist->next;
			}
	!		printf("</select>\n<br>\n");
		}
	+ /*	printf("<input type=hidden name=maxhits value=\"%s\">\n", maxhits);*/
	+ /*	printf("<input type=hidden name=sorttype value=\"%s\">\n", sorttype);*/
	+	printf("Maxhits: ");
	+	printf("<select name=\"maxhits\">\n");
	+	printf("<option> 10\n");
	+	printf("<option> 20\n");
	+	printf("<option> 40\n");
	+	printf("<option> 100\n");
	+	printf("<option value=9999> all\n");
	+	printf("</select>\n<br>\n");
	+	printf("Sorttype: ");
	+	printf("<select name=\"sorttype\">\n");
	+	printf("<option value=score> Score\n");
	+	printf("<option value=lines> Lines\n");
	+	printf("<option value=bytes> Bytes\n");
	+	printf("<option value=title> Title\n");
	+	printf("<option value=type> Type\n");
	+	printf("</select>\n<br>\n");
		printf("<input type=hidden name=message value=\"%s\">\n",
		"If you can see this, then your browser can't support hidden fields.");
		printf("<input type=hidden name=source value=\"%s\">\n", source);
		printf("<input type=hidden name=sourcedir value=\"%s\">\n", sourcedir);
		printf("<input type=hidden name=host value=\"%s\">\n", host);
		printf("<input type=hidden name=port value=\"%s\">\n", port);
		printf("<input type=hidden name=searchprog value=\"%s\">\n",
	
	



Copyright (C) 1996-2003 by Yasukazu Yokoi. All Rights Reserved.