degu.index.ejb
Class PageIndexerLucene

java.lang.Object
  extended by degu.index.ejb.PageIndexerLucene

public class PageIndexerLucene
extends java.lang.Object

Frontend for the lucene page index implemented as a singleton. Write access to the document index is supposed to take place only through this class, that ensures that only one single lucene IndexWriter is used.


Field Summary
private static org.apache.lucene.analysis.Analyzer analyzer
           
private static java.lang.String DEFAULT_INDEX_DIR_STR
           
private static java.io.File INDEX_DIR
           
private static LuceneIndexDescriptor indexDescriptor
           
private static org.apache.lucene.index.IndexWriter indexWriter
           
private static PageIndexerLucene instance
           
private static org.apache.log4j.Logger logger
           
 
Constructor Summary
protected PageIndexerLucene()
           
 
Method Summary
 LuceneIndexDescriptor getIndexDescriptor()
           
static PageIndexerLucene getInstance()
          Returns singleton instance.
 void index(PageTokenizer pageTokenizer, DocumentDescriptor descriptor)
          Adds a document represented as a string and a decriptor to the document index
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

private static PageIndexerLucene instance

DEFAULT_INDEX_DIR_STR

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

INDEX_DIR

private static java.io.File INDEX_DIR

indexWriter

private static org.apache.lucene.index.IndexWriter indexWriter

indexDescriptor

private static LuceneIndexDescriptor indexDescriptor

analyzer

private static org.apache.lucene.analysis.Analyzer analyzer

logger

private static org.apache.log4j.Logger logger
Constructor Detail

PageIndexerLucene

protected PageIndexerLucene()
Method Detail

getInstance

public static PageIndexerLucene getInstance()
                                     throws java.io.IOException
Returns singleton instance. If there is no index INDEX_DIR a new one is created.

Returns:
Throws:
java.io.IOException

index

public void index(PageTokenizer pageTokenizer,
                  DocumentDescriptor descriptor)
           throws java.io.IOException,
                  BadDeguDocumentDescriptor
Adds a document represented as a string and a decriptor to the document index

Parameters:
PageTokenizer - pages to index
descriptor - meta information about the document
Throws:
java.io.IOException
BadDeguDocumentDescriptor

getIndexDescriptor

public LuceneIndexDescriptor getIndexDescriptor()