anl.aida.ae.lucene
Interface TermFunction

All Known Implementing Classes:
DBTermFunction, STCCreator

public interface TermFunction

Interface for classes that manipulate Lucene Term, Document data. This class works in conjunction with the TermScorer. Methods on this interface will be called by the TermScorer as it iterates through the terms and documents. The TermScorer iteration looks like:

 init(int)
 for all terms:
    newTerm(org.apache.lucene.index.Term)
    for all documents:
      calc score
      apply(int, org.apache.lucene.document.Document, int, float)
 done()
 

Note that a Term contains a field and so the actual term text may occur more than once.


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.
 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.
 

Method Detail

init

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

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

newTerm

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

Parameters:
term - the new term.

apply

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) .

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

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

Throws:
AIDAException - if there is an error during the "done" phase.