anl.aida.ae.lucene
Class STCCreator

java.lang.Object
  extended by anl.aida.ae.lucene.STCCreator
All Implemented Interfaces:
TermFunction

public class STCCreator
extends java.lang.Object
implements TermFunction

Creates ScoredTermCollections from a LuceneIndex.


Field Summary
private  STCBuilder builder
           
private  Filter<org.apache.lucene.index.Term> filter
           
private  int index
           
private  cern.colt.map.OpenIntIntHashMap indexMap
           
private  boolean processTerm
           
private  DateRange range
           
private  java.lang.Integer termIndex
           
 
Constructor Summary
STCCreator()
           
 
Method Summary
 void apply(int docId, org.apache.lucene.document.Document doc, int frequency, float score)
          Apply some implementor specific operation to the term and its data.
 ScoredTermsCollection createCollection(org.apache.lucene.index.IndexReader reader, DateRange range)
          Creates a ScoredTermsCollection.
 ScoredTermsCollection createCollection(org.apache.lucene.index.IndexReader reader, Filter<org.apache.lucene.index.Term> filter, DateRange range)
          Creates a ScoredTermsCollection.
 void done()
          Called after apply has been called for all the terms.
 void init(int docCount)
          Called once prior to calling apply for any terms, documents.
 void newTerm(org.apache.lucene.index.Term term)
          Called when a new Term is encounters during iterator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

builder

private STCBuilder builder

termIndex

private java.lang.Integer termIndex

filter

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

range

private DateRange range

processTerm

private boolean processTerm

indexMap

private cern.colt.map.OpenIntIntHashMap indexMap

index

private int index
Constructor Detail

STCCreator

public STCCreator()
Method Detail

createCollection

public ScoredTermsCollection createCollection(org.apache.lucene.index.IndexReader reader,
                                              DateRange range)
                                       throws AIDAException,
                                              java.io.IOException
Creates a ScoredTermsCollection.

Parameters:
reader - the reader used to read the lucene index
range - the date range for this ScoredTermsCollection
Returns:
the created ScoredTermsCollection.
Throws:
AIDAException - if there is an error creating the collecion
java.io.IOException - if there is an error reading the index

createCollection

public ScoredTermsCollection createCollection(org.apache.lucene.index.IndexReader reader,
                                              Filter<org.apache.lucene.index.Term> filter,
                                              DateRange range)
                                       throws AIDAException,
                                              java.io.IOException
Creates a ScoredTermsCollection.

Parameters:
reader - the reader used to read the index.
filter - the terms ultimately included in the collection must pass this filter.
range - the date range for this ScoredTermsCollection
Returns:
the created ScoredTermsCollection.
Throws:
AIDAException - if there is an error creating the collecion
java.io.IOException - if there is an error reading the index

init

public void init(int docCount)
          throws AIDAException
Called once prior to calling apply for any terms, documents.

Specified by:
init in interface TermFunction
Parameters:
docCount - the number of documents in the index.
Throws:
AIDAException - if there is an error during initialization.

newTerm

public void newTerm(org.apache.lucene.index.Term term)
Called when a new Term is encounters during iterator.

Specified by:
newTerm in interface TermFunction
Parameters:
term - the new term.

apply

public void apply(int docId,
                  org.apache.lucene.document.Document doc,
                  int frequency,
                  float score)
           throws AIDAException
Apply some implementor specific operation to the term and its data. The parameters of this call apply to the term passed in the prior call to newTerm(org.apache.lucene.index.Term) .

Specified by:
apply in interface TermFunction
Parameters:
docId - the numeric id of the document. This is only valid between calls to init and done.
doc - the document the term applies to
frequency - the frequency count of the term in the document
score - the score of this term for the specified document.
Throws:
AIDAException - if there is an error.

done

public void done()
          throws AIDAException
Called after apply has been called for all the terms.

Specified by:
done in interface TermFunction
Throws:
AIDAException - if there is an error during the "done" phase.