org.cdlib.xtf.textIndexer
Class IdxTreeCuller

Object
  extended by IdxTreeCuller

public class IdxTreeCuller
extends Object

This class provides a simple mechanism for removing documents from an index when the source text no longer exists in the document library.

This class locates all the summary chunks for documents in an index, and checks to see if the associated source text files exist. If a source text file no longer exists for an indexed document, the summary and text chunks for that document are removed from the index.

To use this class, simply instantiate a copy, and call the cullIndex() method on a directory containing an index. Note that the directory passed may also be a root directory with many index sub-directories if desired.


Constructor Summary
IdxTreeCuller()
           
 
Method Summary
 void cullIndex(File xtfHome, IndexInfo idxInfo)
          Create an IdxTreeCuller instance and call this method to remove documents from indices when the associated source text no longer exists.
private  void deleteIndex(File idxDirToCull)
           
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IdxTreeCuller

public IdxTreeCuller()
Method Detail

cullIndex

public void cullIndex(File xtfHome,
                      IndexInfo idxInfo)
               throws Exception
Create an IdxTreeCuller instance and call this method to remove documents from indices when the associated source text no longer exists.

Performs the actual work of removing missing documents from an index.

Parameters:
xtfHome - The base directory relative to which file paths are interpreted.

idxInfo - The index to cull.

Throws:
Exception - Passes back any exceptions generated by Lucene during the opening of, reading of, or writing to the specified index.


deleteIndex

private void deleteIndex(File idxDirToCull)
                  throws IOException
Throws:
IOException