Friday, March 11, 2011

Simple Command-Line Lucene Demo

The following demo is based on the demo located here:

First, create three one line text files to index and search.  The image below shows the files and contents that I used for this demo.

Now index the files by typing 'java org.apache.lucene.demo.IndexFiles' followed by the files that you want to index.  In the image below you see that I indexed the directory ./testDocs/:

Finally, here are some example searches against the index that show one, two, or no results based the query that was issued.  To issue a query type 'java org.apache.lucene.demo.SearchFiles' and then enter what you want to search for.