Lucene is a high-performance, scalable, search engine technology. Both indexing and searching features make up the Lucene API. The first part of this article takes you through an example of using Lucene to index all the text files in a directory and its subdirectories. Before proceeding to examples of analysis and searching, we'll take a brief detour to discuss the format of the index directory.
Indexing
We'll begin by creating the
Indexer
class that will be used to index all the text files in a specified directory. This class is a utility class with a single public method index()
that takes two arguments. The first argument is a File
object indexDir
that corresponds to the directory where the index will be created. The second argument is another File
object dataDir
that corresponds to the directory to be indexed.Read full article from Journal of Learning Apache Lucene - Lucene In Action | I love programming
No comments:
Post a Comment