mirror of https://github.com/apache/lucene.git
89 lines
3.7 KiB
XML
89 lines
3.7 KiB
XML
<?xml version="1.0"?>
|
|
|
|
<document>
|
|
<properties>
|
|
<author email="acoliver@apache.org">Andrew C. Oliver</author>
|
|
<title>Apache Lucene - Building and Installing the Basic Demo</title>
|
|
</properties>
|
|
<body>
|
|
|
|
<section name="About this Document">
|
|
<p>
|
|
This document is intended as a "getting started" guide to installing and running the
|
|
Apache 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.
|
|
</p>
|
|
</section>
|
|
|
|
|
|
<section name="About the Demos">
|
|
<p>
|
|
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. It's 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.
|
|
</p>
|
|
</section>
|
|
|
|
<section name="Indexing Files">
|
|
<p>
|
|
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
|
|
<b> "java org.apache.lucene.demo.IndexHTML -create -index {index-dir} .."</b>.
|
|
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 <b>/opt/lucene/index</b> for this index.
|
|
</p>
|
|
</section>
|
|
|
|
<section name="Deploying the Demos">
|
|
<p>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. </p>
|
|
</section>
|
|
|
|
<section name="Configuration">
|
|
<p>
|
|
From your Tomcat directory look in the webapps/luceneweb subdirectory. If it's 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 finished altering the configuration you should
|
|
restart Tomcat. You may also wish to update the war file by typing
|
|
<b>jar -uf luceneweb.war configuration.jsp</b> from the luceneweb subdirectory.
|
|
(The -u option is not available in all versions of jar. In this case recreate the war file).
|
|
</p>
|
|
</section>
|
|
|
|
<section name="Running the Demos">
|
|
<p>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.</p>
|
|
<p>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).</p>
|
|
</section>
|
|
|
|
<section name="About the code...">
|
|
<p>
|
|
If you want to know more about how this web app works or how to customize it then
|
|
<a href="demo4.html">read on>>></a>.
|
|
</p>
|
|
</section>
|
|
|
|
</body>
|
|
</document>
|
|
|