|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectanl.aida.ae.lucene.DBTermFunction
public class DBTermFunction
TermFunction implementation that inserts the term data into a database. The db config info is stored in term_count_db.properties.
Field Summary | |
---|---|
private java.sql.Connection |
connection
|
private org.apache.lucene.index.Term |
currentTerm
|
private java.sql.Date |
date
|
private static java.lang.String |
DOC_FIND
|
private java.util.Map<java.lang.Integer,java.lang.Integer> |
docCache
|
private java.util.Map<java.lang.String,java.lang.Integer> |
fieldCache
|
private java.sql.PreparedStatement |
findDoc
|
private java.sql.PreparedStatement |
findTerm
|
private static java.lang.String |
INSERT_DOC
|
private static java.lang.String |
INSERT_FIELD
|
private static java.lang.String |
INSERT_TERM
|
private static java.lang.String |
INSERT_TERM_SCORE
|
private java.sql.PreparedStatement |
insertDoc
|
private java.sql.PreparedStatement |
insertField
|
private java.sql.PreparedStatement |
insertScore
|
private java.sql.PreparedStatement |
insertTerm
|
private static java.lang.String |
TERM_FIND
|
Constructor Summary | |
---|---|
DBTermFunction(java.util.Date date)
|
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()
Commits any changes to the DB. |
private int |
findDocId(int lucDocId,
org.apache.lucene.document.Document doc)
|
private int |
findFieldId(java.lang.String field)
|
private int |
findTermId(org.apache.lucene.index.Term term,
int docId,
org.apache.lucene.document.Document doc)
|
void |
init(int docCount)
Initializes the DB connection. |
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 |
---|
private static final java.lang.String DOC_FIND
private static final java.lang.String TERM_FIND
private static final java.lang.String INSERT_FIELD
private static final java.lang.String INSERT_DOC
private static final java.lang.String INSERT_TERM
private static final java.lang.String INSERT_TERM_SCORE
private java.sql.Connection connection
private java.util.Map<java.lang.String,java.lang.Integer> fieldCache
private java.util.Map<java.lang.Integer,java.lang.Integer> docCache
private java.sql.PreparedStatement findDoc
private java.sql.PreparedStatement findTerm
private java.sql.PreparedStatement insertField
private java.sql.PreparedStatement insertDoc
private java.sql.PreparedStatement insertTerm
private java.sql.PreparedStatement insertScore
private java.sql.Date date
private org.apache.lucene.index.Term currentTerm
Constructor Detail |
---|
public DBTermFunction(java.util.Date date)
Method Detail |
---|
public void init(int docCount) throws AIDAException
init
in interface TermFunction
docCount
- the number of documents in the index.
AIDAException
- if there is an error during initialization.public void done() throws AIDAException
done
in interface TermFunction
AIDAException
- if there is an error during the "done" phase.public void newTerm(org.apache.lucene.index.Term term)
newTerm
in interface TermFunction
term
- the new term.public void apply(int docId, org.apache.lucene.document.Document doc, int frequency, float score) throws AIDAException
apply
in interface TermFunction
docId
- the numeric id of the document. This is only valid between calls to init
and done.doc
- the document the term applies tofrequency
- the frequency count of the term in the documentscore
- the score of this term for the specified document.
AIDAException
- if there is an error.private int findTermId(org.apache.lucene.index.Term term, int docId, org.apache.lucene.document.Document doc) throws java.sql.SQLException, java.text.ParseException
java.sql.SQLException
java.text.ParseException
private int findDocId(int lucDocId, org.apache.lucene.document.Document doc) throws java.sql.SQLException, java.text.ParseException
java.sql.SQLException
java.text.ParseException
private int findFieldId(java.lang.String field) throws java.sql.SQLException
java.sql.SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |