anl.aida.ae.lucene
Class CacheCreator

java.lang.Object
  extended by anl.aida.ae.lucene.CacheCreator

public class CacheCreator
extends java.lang.Object

Date: Mar 5, 2009 11:38:37 AM


Nested Class Summary
private static class CacheCreator.AllFilter
           
 
Field Summary
private  DateRangeProducer drProducer
           
private  Filter<org.apache.lucene.index.Term> filter
           
private  java.text.DateFormat format
           
private static java.lang.String LUCENE_INDEX_NAME
           
private  org.apache.lucene.index.IndexReader reader
           
 
Constructor Summary
CacheCreator(DateRangeProducer drProducer, Filter<org.apache.lucene.index.Term> filter, org.apache.lucene.index.IndexReader reader)
           
CacheCreator(DateRangeProducer drProducer, org.apache.lucene.index.IndexReader reader)
           
 
Method Summary
private  void copyIndex(java.io.File outputDir)
           
 void createCache(java.io.File outputDir, ReaderProducer readerProducer, Keywords keywords)
          Creates the cache in the specified directory.
private  void createSTC(java.io.File indexDir, java.lang.String filename, DateRange range)
           
private  void createTmpIndex(java.io.File tmpDir, DateRange range, ReaderProducer rProducer, Keywords keywords)
           
private  void deleteFiles(java.io.File dir)
           
private  java.lang.String makeFileName(java.io.File outputDir, DateRange range, java.lang.String prefix)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LUCENE_INDEX_NAME

private static final java.lang.String LUCENE_INDEX_NAME
See Also:
Constant Field Values

filter

private Filter<org.apache.lucene.index.Term> filter

reader

private org.apache.lucene.index.IndexReader reader

format

private java.text.DateFormat format

drProducer

private DateRangeProducer drProducer
Constructor Detail

CacheCreator

public CacheCreator(DateRangeProducer drProducer,
                    org.apache.lucene.index.IndexReader reader)

CacheCreator

public CacheCreator(DateRangeProducer drProducer,
                    Filter<org.apache.lucene.index.Term> filter,
                    org.apache.lucene.index.IndexReader reader)
Method Detail

deleteFiles

private void deleteFiles(java.io.File dir)

makeFileName

private java.lang.String makeFileName(java.io.File outputDir,
                                      DateRange range,
                                      java.lang.String prefix)

createCache

public void createCache(java.io.File outputDir,
                        ReaderProducer readerProducer,
                        Keywords keywords)
                 throws java.io.IOException,
                        AIDAException,
                        java.text.ParseException
Creates the cache in the specified directory. If the output directory exists, it will be deleted and recreated.

Parameters:
outputDir - the directory in which the cache is created
Throws:
java.io.IOException - if there is a file error while creating the cache
AIDAException - if there is a general error while creating the cache
java.text.ParseException

copyIndex

private void copyIndex(java.io.File outputDir)
                throws java.io.IOException
Throws:
java.io.IOException

createSTC

private void createSTC(java.io.File indexDir,
                       java.lang.String filename,
                       DateRange range)
                throws java.io.IOException,
                       AIDAException
Throws:
java.io.IOException
AIDAException

createTmpIndex

private void createTmpIndex(java.io.File tmpDir,
                            DateRange range,
                            ReaderProducer rProducer,
                            Keywords keywords)
                     throws java.io.IOException,
                            java.text.ParseException
Throws:
java.io.IOException
java.text.ParseException