lucene/xdocs/demo.xml

75 lines
2.4 KiB
XML
Raw Normal View History

<?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 using and running the Lucene demos.
It walks you through some basic installation and configuration.
</p>
</section>
<section name="About the Demos">
<p>
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.
</p>
</section>
<section name="Setting your CLASSPATH">
<p>
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.
</p>
<p>
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.
</p>
</section>
<section name="Indexing Files">
<p>
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.
</p>
<p>
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.
</p>
</section>
<section name="About the code...">
<p>
<a href="demo2.html">read on&gt;&gt;&gt;</a>
</p>
</section>
</body>
</document>