Jakarta Lucene

About

Resources

Download

Jakarta

About this Document
このドキュメントについて

This document is intended as a "getting started" guide to installing and running the Jakarta Lucene web application demo. This guide assumes that you have read the information in the previous two examples or already know it anyhow. We'll use Tomcat 4.0.1 as our reference web container. These demos should work with nearly any container, but it is up to you to adapt them appropriately.

このドキュメントは、Jakarta LuceneのWebアプリケーションデモをインストールし、 動かすための"スタートアップ" ガイドとして書かれています。 このガイドは、前二つの例に書かれている情報を読んでいるか、 すでに知っていることを前提としています。 参照するWebコンテナとして、Tomcat 4.0.1 を使っています。 このデモは、他のコンテナでも動作するはずですが、きちんと動くようにするのは、 あなたの腕次第です。


About the Demos
デモについて

The Lucene Web Application demo is a template web application intended for deployment on Tomcat or a similar web container. It's NOT designed as a "best practices" implementation by ANY means. Its more of a "hello world" type Lucene Web App. The purpose of this application is to demonstrate Lucene. With that being said, it should be relatively simple to create a small searchable website in Tomcat or a similar application server.

Lucene のWebアプリケーションデモは、テンプレートWebアプリケーションで、 Tomcatや同等のWebコンテナに配置できるように作られています。 "一番良い例"を示した実装として設計されているわけではありません。 むしろ、Lucene Webアプリケーションの"hello World" といっても良いでしょう。 このアプリケーションの目的は、Luceneをデモンストレーションすることにあります。 つまり、比較的簡単に、小さな検索可能なWebサイトをTomcatや同等なアプリケーションサーバーで作成します。


Indexing Files
ファイルのインデックスを作る

Once you've gotten this far you're probably itching to go. Let's start by creating the index you'll need for the web examples. Since you've already set your classpath in the previous examples, all you need to do is type "java org.apache.lucene.demo.IndexHTML -create -index {index-dir} ..". You'll need to do this from a (any) subdirectory of your {tomcat}/webapps directory (make sure you didn't leave off the ".." or you'll get a null pointer exception). {index-dir} should be a directory that Tomcat has permission to read and write, but is outside of a web accessible context. By default the webapp is configured to look in /opt/lucene/index for this index.

ここまで来たら、きっとうずうずしていることでしょう。 さあ、Webの例に必要なインデックスを作りましょう。 前の例でクラスパスを設定してあるので、 "java org.apache.lucene.demo.IndexHTML -create -index {インデックスディレクトリ} .." と打つだけです。 ただし、{tomcat}/webappsディレクトリのサブディレクトリから行わなければなりません (".." を忘れないでください。忘れるとNullPointerExceptionが発生します) 。 {インデックスディレクトリ} は、TomcatがRead/Writeの権限を持っているディレクトリで、 Webがアクセスできるコンテクストの外に置きます。 デフォルトでは、/opt/lucene/indexからインデックスを探すように設定されています。


Deploying the Demos
デモを設置する

Located in your distribution directory you should see a war file called luceneweb.war. Copy this to your {tomcat-home}/webapps directory. You may need to restart Tomcat.

ディストリビューションのディレクトリに、 luceneweb.warというwarファイルがあるはずです。 これを{tomcatホーム}/webappsディレクトリにコピーします。 設定によっては、Tomcatを再起動しる必要があります。


Configuration
設定

From your Tomcat directory look in the webapps/luceneweb subdirectory. If its not present, try browsing to "http://localhost:8080/luceneweb" then look again. Edit a file called configuration.jsp. Ensure that the indexLocation is equal to the location you used for your index. You may also customize the appTitle and appFooter strings as you see fit. Once you have finsihed altering the configuration you should restart Tomcat. You may also wish to update the war file by typing jar -uf luceneweb.war configuration.jsp from the luceneweb subdirectory. (The u option is not available in all versions of jar. In this case recreate the war file).

Tomcatディレクトリから、webbapps/luceneweb サブディレクトリを見ます。 存在していれば、"http://localhost:8080/luceneweb"にブラウザでアクセスして、 もう一度見てみましょう。 configuration.jspというファイルを編集します。 indexLocationがインデックス用に使用している位置と等しいか確認します。 また、appTitleやappFooterという文字列を、適当だと思うものにカスタマイズします。 設定を変更し終わったら、Tomcatを再起動します。 lucenewebサブディレクトリから、jar -uf luceneweb.war configuration.jsp とタイプして、warファイルをアップデートしておくと良いでしょう。 (uオプションは、すべてのバージョンのjarで使えるわけではありません。 この場合は、warファイルを作り直してください)


Running the Demos
デモを実行する

Now you're ready to roll. In your browser set the url to "http://localhost:8080/luceneweb" enter "test" and the number of items per page and press search.

さあ、さいを投げる準備ができました。 ブラウザを開いて、URLを"http://localhost:8080/luceneweb"にセットします。 "test"と入力し、一ページに表示する検索結果の数を入力して、searchボタンを押します。

You should now be looking either at a number of results (provided you didn't erase the Tomcat examples) or nothing. Try other search terms. Depending on the number of items per page you set and results returned, there may be a link at the bottom that says "more results>>", clicking it goes to subsequent pages. If you get an error regarding opening the index, then you probably set the path in "configuration" incorrectly or Tomcat doesn't have permissions to the index (or you skipped the step of creating it).

(もしTomcatの例題を削除していなければ) たくさんの検索結果が表示されているでしょうし、そうでなければ何も表示されていないでしょう。 別の検索語を試してみましょう。 設定したページ毎の検索結果表示数と実際の検索結果によって、 ページの一番下に"more results>>" というリンクがあって、 クリックすると次のページに行きます。 インデックスを開く時にエラーが発生した場合、"設定"に書かれているパスが間違っているか、 Tomcatがインデックスを読む権限を持っていないのでしょう (あるいはインデックスを作りわすれているか) 。


About the code...
コードについて...

If you want to know more about how this web app works or how to customize it then read on>>>.

このWebアプリケーションが動く仕組みや、カスタマイズする方法についてもっと知りたい方は、 つづく>>>



Copyright © 1999-2002, Apache Software Foundation