de.nava.informa.search
Class ChannelIndexer

java.lang.Object
  extended by de.nava.informa.search.ChannelIndexer

public final class ChannelIndexer
extends Object

Utility class which allows to generate respective maintain a fulltext index for news items.

Author:
Niko Schmuck (niko@nava.de)

Constructor Summary
ChannelIndexer(String indexDir)
          Constructor which allows to specify the index directory.
 
Method Summary
 String getIndexDir()
           
 int getNrOfIndexedItems()
          Returns the number of documents that were in the index last time the index operation was performed.
 void indexChannels(boolean createNewIndex, Collection channels)
          Index all news items contained in the given channels.
 void indexItems(boolean createNewIndex, Collection<ItemIF> items)
          Index all given news items.
 void setIndexDir(String indexDir)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChannelIndexer

public ChannelIndexer(String indexDir)
Constructor which allows to specify the index directory. For the full-text indexing process the lucene StandardAnalyzer is used.

Parameters:
indexDir - - The directory in which the index files are stored.
Method Detail

indexChannels

public void indexChannels(boolean createNewIndex,
                          Collection channels)
                   throws IOException
Index all news items contained in the given channels.

Parameters:
createNewIndex - - wether a new index should be generated or an existant one should be taken into account
channels - - a collection of ChannelIF objects
Throws:
IOException

indexItems

public void indexItems(boolean createNewIndex,
                       Collection<ItemIF> items)
                throws IOException
Index all given news items.

Parameters:
createNewIndex - - Wether a new index should be generated or an existant one should be taken into account.
items - - A collection of ItemIF objects.
Throws:
IOException

getNrOfIndexedItems

public int getNrOfIndexedItems()
Returns the number of documents that were in the index last time the index operation was performed. Note: Use only directly after the indexing process, otherwise the return value may be wrong.


setIndexDir

public void setIndexDir(String indexDir)

getIndexDir

public String getIndexDir()


Copyright © 2002-2007 Niko Schmuck. All Rights Reserved.