anl.aida.ae.lucene
Class LuceneConsumer

java.lang.Object
  extended by org.apache.uima.analysis_component.AnalysisComponent_ImplBase
      extended by org.apache.uima.analysis_component.Annotator_ImplBase
          extended by org.apache.uima.analysis_component.CasAnnotator_ImplBase
              extended by anl.aida.ae.lucene.LuceneConsumer
All Implemented Interfaces:
org.apache.uima.analysis_component.AnalysisComponent

public class LuceneConsumer
extends org.apache.uima.analysis_component.CasAnnotator_ImplBase

UIMA CAS Consumer that writes that writes a CAS' document contents as well as mapped annotations to a lucene index. The annotations to map are specified in an XML mapping file.


Nested Class Summary
private static class LuceneConsumer.CacheFieldBuilder
           
 
Field Summary
private  java.util.List<FieldBuilder> builders
           
static java.lang.String CACHE_LENGTH_DAYS
           
static java.lang.String CACHE_OUTPUT_DIR
           
static java.lang.String CACHE_START_DATE
           
static java.lang.String CACHE_TS_INTERVAL_DAYS
           
static java.lang.String CACHED_CONTENT_DIR
           
private  java.lang.String cacheDir
           
private  int cacheIntervalDays
           
private  int cacheLengthDays
           
static java.lang.String CLEAR_INDEX
           
static java.lang.String CREATE_CACHE
           
private  boolean createCache
           
private  DocumentBuilder docBuilder
           
private  FieldBuilderFactory factory
           
private  java.lang.Boolean filterCache
           
static java.lang.String INDEX_DIR
           
private  java.lang.String indexDir
           
static java.lang.String KEYWORD_FILTER
           
private  Keywords keywords
           
private  org.apache.uima.util.Logger logger
           
static java.lang.String MAPPING_FILE
           
private static java.lang.String MESSAGE_DIGEST
           
private  java.lang.String outputDir
           
private  java.lang.String startDate
           
private  org.apache.lucene.analysis.Token token
           
private  org.apache.lucene.index.IndexWriter writer
           
 
Constructor Summary
LuceneConsumer()
           
 
Method Summary
private  void addKeyword(org.apache.lucene.document.Field field, java.lang.String keywordType, org.apache.lucene.document.Document doc)
           
 void collectionProcessComplete()
           
private  void createCache()
           
private  void deleteFile(java.io.File dir)
           
 void initialize(org.apache.uima.UimaContext context)
           
 void process(org.apache.uima.cas.CAS cas)
           
 void typeSystemInit(org.apache.uima.cas.TypeSystem typeSystem)
           
 
Methods inherited from class org.apache.uima.analysis_component.CasAnnotator_ImplBase
getRequiredCasInterface, process
 
Methods inherited from class org.apache.uima.analysis_component.Annotator_ImplBase
getCasInstancesRequired, hasNext, next
 
Methods inherited from class org.apache.uima.analysis_component.AnalysisComponent_ImplBase
batchProcessComplete, destroy, getContext, getResultSpecification, reconfigure, setResultSpecification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MESSAGE_DIGEST

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

MAPPING_FILE

public static final java.lang.String MAPPING_FILE
See Also:
Constant Field Values

INDEX_DIR

public static final java.lang.String INDEX_DIR
See Also:
Constant Field Values

CLEAR_INDEX

public static final java.lang.String CLEAR_INDEX
See Also:
Constant Field Values

CACHED_CONTENT_DIR

public static final java.lang.String CACHED_CONTENT_DIR
See Also:
Constant Field Values

CREATE_CACHE

public static final java.lang.String CREATE_CACHE
See Also:
Constant Field Values

CACHE_OUTPUT_DIR

public static final java.lang.String CACHE_OUTPUT_DIR
See Also:
Constant Field Values

CACHE_START_DATE

public static final java.lang.String CACHE_START_DATE
See Also:
Constant Field Values

CACHE_LENGTH_DAYS

public static final java.lang.String CACHE_LENGTH_DAYS
See Also:
Constant Field Values

KEYWORD_FILTER

public static final java.lang.String KEYWORD_FILTER
See Also:
Constant Field Values

CACHE_TS_INTERVAL_DAYS

public static final java.lang.String CACHE_TS_INTERVAL_DAYS
See Also:
Constant Field Values

docBuilder

private DocumentBuilder docBuilder

writer

private org.apache.lucene.index.IndexWriter writer

builders

private java.util.List<FieldBuilder> builders

factory

private FieldBuilderFactory factory

cacheDir

private java.lang.String cacheDir

indexDir

private java.lang.String indexDir

startDate

private java.lang.String startDate

outputDir

private java.lang.String outputDir

cacheLengthDays

private int cacheLengthDays

cacheIntervalDays

private int cacheIntervalDays

createCache

private boolean createCache

logger

private org.apache.uima.util.Logger logger

token

private org.apache.lucene.analysis.Token token

keywords

private Keywords keywords

filterCache

private java.lang.Boolean filterCache
Constructor Detail

LuceneConsumer

public LuceneConsumer()
Method Detail

typeSystemInit

public void typeSystemInit(org.apache.uima.cas.TypeSystem typeSystem)
                    throws org.apache.uima.analysis_engine.AnalysisEngineProcessException
Overrides:
typeSystemInit in class org.apache.uima.analysis_component.CasAnnotator_ImplBase
Throws:
org.apache.uima.analysis_engine.AnalysisEngineProcessException

deleteFile

private void deleteFile(java.io.File dir)

initialize

public void initialize(org.apache.uima.UimaContext context)
                throws org.apache.uima.resource.ResourceInitializationException
Specified by:
initialize in interface org.apache.uima.analysis_component.AnalysisComponent
Overrides:
initialize in class org.apache.uima.analysis_component.AnalysisComponent_ImplBase
Throws:
org.apache.uima.resource.ResourceInitializationException

process

public void process(org.apache.uima.cas.CAS cas)
             throws org.apache.uima.analysis_engine.AnalysisEngineProcessException
Specified by:
process in class org.apache.uima.analysis_component.CasAnnotator_ImplBase
Throws:
org.apache.uima.analysis_engine.AnalysisEngineProcessException

addKeyword

private void addKeyword(org.apache.lucene.document.Field field,
                        java.lang.String keywordType,
                        org.apache.lucene.document.Document doc)
                 throws java.io.IOException
Throws:
java.io.IOException

collectionProcessComplete

public void collectionProcessComplete()
                               throws org.apache.uima.analysis_engine.AnalysisEngineProcessException
Specified by:
collectionProcessComplete in interface org.apache.uima.analysis_component.AnalysisComponent
Overrides:
collectionProcessComplete in class org.apache.uima.analysis_component.AnalysisComponent_ImplBase
Throws:
org.apache.uima.analysis_engine.AnalysisEngineProcessException

createCache

private void createCache()
                  throws java.io.IOException,
                         AIDAException,
                         java.text.ParseException
Throws:
java.io.IOException
AIDAException
java.text.ParseException