sitelink1  
sitelink2  
sitelink3  
extra_vars4  
extra_vars5  
extra_vars6  

Marrying Digester and Lucene

Now that you know how to use each of these tools on their own, we can combine the two classes we've written. We'll use Digester to handle XML parsing, and Lucene to handle indexing. You can see the resulting DigesterMarriesLucene class in Listing 4. (Clicking Listing 4 causes a new browser window to open. Keep that window open so you can refer to Listing 4 while reading the following discussion.)

Let's look at some selections from this class in more detail. Just as we did in the AddressBookIndexer class, we need to open the Lucene index for writing using IndexWriter; we do so here in Listing 5. We pass in the path to the index directory, the Analyzer to process all data being indexed, and a createFlag that is set to true, so that the index is opened in the append mode.