13.5. Creating an Index with LuceneIndexCreation.jar

To get started with ZSearch quickly, a JAR file (Java) has been created to generate an index from the command line. For more information on JAR files, please visit: http://java.sun.com/docs/books/tutorial/jar/basics/index.html.

LuceneIndexCreation.jar consumes text files and builds an index from them. Usage:

java -jar LuceneIndexCreation.jar [-c] [-s] <document_directory> <index_directory>
-c   - force index to be case sensitive
-s   - store content in the index

This command consumes the directory <document_directory>, including all of its subdirectories, and produces a Lucene index. The index is a set of files that will be stored in a separate directory that is specified by <index_directory>.

For each document to be indexed, LuceneIndexCreation creates a document object with three fields: a contents field containing the contents (body) of the document, a modified field containing the file modification time, and the full path and filename in a path field.

If -c is specified, then index is forced to be case sensitive. Otherwise all terms are converted to lower case before to be added into the index.

If -s is specified, then document's content is also stored in the index and can be retrieved with path and modified fields.

Otherwise only path and modified fields are stored, and contents field is only indexed. In this case document content must be retrieved from an original source by its path.

Please be careful, using -s option increases index size near five times.