Apache Lucene

About

Resources

Download

About this Document

This document is intended as a "getting started" guide to using and running the Apache Lucene demos. It walks you through some basic installation and configuration.


About the Demos

The Lucene Demo code is a set of command line example applications that demonstrate various functionality of Lucene and how one should go about adding it to their applications.


Setting your classpath

First, extract the latest Lucene distribution.

You should see the Apache Lucene jar file in the directory you created when you extracted the archive. It should be named something like lucene-{version}.jar.

You should also see a file called called lucene-demos-{version}.jar. Put both of these files in your Java CLASSPATH.


Indexing Files

Once you've gotten this far you're probably itching to go. Let's build an index! Assuming you've set your classpath correctly, just type "java org.apache.lucene.demo.IndexFiles {full-path-to-lucene}/src". This will produce a subdirectory called "index" which will contain an index of all of the Lucene sourcecode.

To search the index type "java org.apache.lucene.demo.SearchFiles". 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.


About the code...

read on>>>



Copyright © 1999-2005, The Apache Software Foundation