org.activemath.omdocjdom.lucene
Class LuceneMBaseStorage

java.lang.Object
  extended by org.activemath.omdocjdom.lucene.LuceneMBaseStorage

public class LuceneMBaseStorage
extends Object


Field Summary
protected static org.apache.commons.logging.Log log
           
 
Method Summary
 String addMassStorageItem(String content)
          Writes the stored value and returns a token for it.
 void addSmallDocument(org.apache.lucene.document.Document doc)
           
 void closeWriting()
           
 void deleteMassStorageItem(String label)
          Deletes the indicated element, don't forget to call renewIndexReaders() after deletions.
 int deleteSmallDocument(org.apache.lucene.index.Term term)
          Deletes the document from the small-documents and also all mass storage entries whose labels are contained in the fields provided as massStorageFields.
protected  void finalize()
           
static LuceneMBaseStorage getInstance()
           
static LuceneMBaseStorage getInstance(Subconfiguration config, Set massFieldNames, org.apache.lucene.analysis.Analyzer analyzer)
           
 org.apache.lucene.document.Document getSmallDocument(org.apache.lucene.index.Term term)
           
 org.apache.lucene.document.Document getSmallDocumentAtId(String id)
           
static void main(String[] args)
          Called to verify the coherence between small and mass indices.
 void makeDatabaseFresh()
           
 void openWriting()
           
 void optimize()
           
 Reader readMassStorageItem(String label)
           
 String readStringMassOfStorageItem(String label)
           
 void renewIndexReaders()
           
 org.apache.lucene.search.Hits searchSmallDocument(org.apache.lucene.search.Query q)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log
Method Detail

getInstance

public static LuceneMBaseStorage getInstance()

getInstance

public static LuceneMBaseStorage getInstance(Subconfiguration config,
                                             Set massFieldNames,
                                             org.apache.lucene.analysis.Analyzer analyzer)
                                      throws IOException
Throws:
IOException

makeDatabaseFresh

public void makeDatabaseFresh()
                       throws IOException
Throws:
IOException

openWriting

public void openWriting()
                 throws IOException
Throws:
IOException

closeWriting

public void closeWriting()
                  throws IOException
Throws:
IOException

optimize

public void optimize()
              throws IOException
Throws:
IOException

renewIndexReaders

public void renewIndexReaders()
                       throws IOException
Throws:
IOException

addMassStorageItem

public String addMassStorageItem(String content)
                          throws IOException
Writes the stored value and returns a token for it.

Returns:
the label that will be used to fetch the content
Throws:
IOException

readStringMassOfStorageItem

public String readStringMassOfStorageItem(String label)
                                   throws IOException
Throws:
IOException

readMassStorageItem

public Reader readMassStorageItem(String label)
                           throws IOException
Throws:
IOException

deleteMassStorageItem

public void deleteMassStorageItem(String label)
                           throws IOException
Deletes the indicated element, don't forget to call renewIndexReaders() after deletions.

Parameters:
label -
Throws:
IOException

addSmallDocument

public void addSmallDocument(org.apache.lucene.document.Document doc)
                      throws IOException
Throws:
IOException

getSmallDocument

public org.apache.lucene.document.Document getSmallDocument(org.apache.lucene.index.Term term)
                                                     throws IOException
Throws:
IOException

getSmallDocumentAtId

public org.apache.lucene.document.Document getSmallDocumentAtId(String id)
                                                         throws IOException
Throws:
IOException

searchSmallDocument

public org.apache.lucene.search.Hits searchSmallDocument(org.apache.lucene.search.Query q)
                                                  throws IOException
Throws:
IOException

deleteSmallDocument

public int deleteSmallDocument(org.apache.lucene.index.Term term)
                        throws IOException
Deletes the document from the small-documents and also all mass storage entries whose labels are contained in the fields provided as massStorageFields.

Parameters:
term - the term to search for deletion
Returns:
the number of documents deleted (max 128)
Throws:
IOException

finalize

protected void finalize()
Overrides:
finalize in class Object

main

public static void main(String[] args)
                 throws Throwable
Called to verify the coherence between small and mass indices.

Parameters:
args - the path to the searchIndices
Throws:
Throwable