2002-01-26 10:01:32 -05:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
<document>
|
|
|
|
<properties>
|
|
|
|
<author email="acoliver@apache.org">Andrew C. Oliver</author>
|
2005-02-14 11:48:47 -05:00
|
|
|
<title>Apache Lucene - Building and Installing the Basic Demo</title>
|
2002-01-26 10:01:32 -05:00
|
|
|
</properties>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<section name="About this Document">
|
|
|
|
<p>
|
2006-08-03 18:24:42 -04:00
|
|
|
This document is intended as a "getting started" guide to using and running the Lucene demos.
|
|
|
|
It walks you through some basic installation and configuration.
|
2002-01-26 10:01:32 -05:00
|
|
|
</p>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
<section name="About the Demos">
|
|
|
|
<p>
|
2006-08-03 18:24:42 -04:00
|
|
|
The Lucene command-line demo code consists of two applications that demonstrate various
|
|
|
|
functionalities of Lucene and how one should go about adding Lucene to their applications.
|
2002-01-26 10:01:32 -05:00
|
|
|
</p>
|
|
|
|
</section>
|
|
|
|
|
2006-08-03 18:24:42 -04:00
|
|
|
<section name="Setting your CLASSPATH">
|
2002-01-26 10:01:32 -05:00
|
|
|
<p>
|
2006-08-03 18:24:42 -04:00
|
|
|
First, you should <a href="http://www.apache.org/dyn/closer.cgi/lucene/java/">download</a> the
|
|
|
|
latest Lucene distribution and then extract it to a working directory. Alternatively, you can <a
|
|
|
|
href="http://wiki.apache.org/jakarta-lucene/SourceRepository">check out the sources from
|
|
|
|
Subversion</a>, and then run <code>ant war-demo</code> to generate the JARs and WARs.
|
2002-01-26 10:01:32 -05:00
|
|
|
</p>
|
|
|
|
<p>
|
2006-08-03 18:24:42 -04:00
|
|
|
You should see the Lucene JAR file in the directory you created when you extracted the archive. It
|
|
|
|
should be named something like <code>lucene-core-{version}.jar</code>. You should also see a file
|
|
|
|
called <code>lucene-demos-{version}.jar</code>. If you checked out the sources from Subversion then
|
|
|
|
the JARs are located under the <code>build</code> subdirectory (after running <code>ant</code>
|
|
|
|
successfully). Put both of these files in your Java CLASSPATH.
|
2002-01-26 10:01:32 -05:00
|
|
|
</p>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section name="Indexing Files">
|
|
|
|
<p>
|
2006-08-03 18:24:42 -04:00
|
|
|
Once you've gotten this far you're probably itching to go. Let's <b>build an index!</b> Assuming
|
|
|
|
you've set your CLASSPATH correctly, just type:
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
java org.apache.lucene.demo.IndexFiles {full-path-to-lucene}/src
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
This will produce a subdirectory called <code>index</code> which will contain an index of all of the
|
|
|
|
Lucene source code.
|
2002-01-26 10:01:32 -05:00
|
|
|
</p>
|
|
|
|
<p>
|
2006-08-03 18:24:42 -04:00
|
|
|
To <b>search the index</b> type:
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
java org.apache.lucene.demo.SearchFiles
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
You'll be prompted for a query. Type in a swear word and press the enter key. You'll see that the
|
|
|
|
Lucene developers are very well mannered and get no results. Now try entering the word "vector".
|
|
|
|
That should return a whole bunch of documents. The results will page at every tenth result and ask
|
|
|
|
you whether you want more results.
|
2002-01-26 10:01:32 -05:00
|
|
|
</p>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section name="About the code...">
|
|
|
|
<p>
|
|
|
|
<a href="demo2.html">read on>>></a>
|
|
|
|
</p>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</document>
|
|
|
|
|