net.sf.zekr.engine.search.lucene
Class LuceneIndexManager

java.lang.Object
  extended by net.sf.zekr.engine.search.lucene.LuceneIndexManager

public class LuceneIndexManager
extends java.lang.Object

This class manages Lucene indices for Quran and translations.

Author:
Mohsen Saboorian

Constructor Summary
LuceneIndexManager(org.apache.commons.configuration.PropertiesConfiguration props)
           
 
Method Summary
 void createQuranIndex(IQuranText quranText, int mode, java.lang.String path, java.io.PrintStream stdout)
          This method silently indexes a Quran text.
 ZekrIndexReader getIndex(IQuranText quranText)
           
 ZekrIndexReader getIndex(TranslationData td)
           
 ZekrIndexReader getQuranIndex()
          This method first checks if the Quran is previously indexed (first in user home and then in installation directory).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LuceneIndexManager

public LuceneIndexManager(org.apache.commons.configuration.PropertiesConfiguration props)
Method Detail

getQuranIndex

public ZekrIndexReader getQuranIndex()
                              throws IndexingException
This method first checks if the Quran is previously indexed (first in user home and then in installation directory). If not, it will try to index it, asking user where to index. If this is already indexed, returns the directory where Quran indices are.

Returns:
directory of the Quran index if indexing was successful (or found index somewhere), null otherwise
Throws:
IndexingException - if indexing or opening existing index failed

getIndex

public ZekrIndexReader getIndex(IQuranText quranText)
                         throws IndexingException
Throws:
IndexingException

getIndex

public ZekrIndexReader getIndex(TranslationData td)
                         throws IndexingException
Throws:
IndexingException

createQuranIndex

public void createQuranIndex(IQuranText quranText,
                             int mode,
                             java.lang.String path,
                             java.io.PrintStream stdout)
                      throws IndexingException
This method silently indexes a Quran text. It should only be used for command line indexing. This method sets index.[quran/trans].path[.trans id] property to the index directory, if indexing finished without throwing IndexingException.

Parameters:
mode - can be IndexCreator.ME_ONLY or IndexCreator.ALL_USERS.
path - path for creating indices in. Used iff mode is equal to IndexCreator.CUSTOM_PATH
stdout - standard output to write progressing data to
Throws:
IndexingException - if any error occurred during indexing process.