org.sakaiproject.search.index.impl
Class SearchIndexStorage

java.lang.Object
  extended by org.sakaiproject.search.index.impl.SearchIndexStorage
All Implemented Interfaces:
Diagnosable, IndexStorage

public class SearchIndexStorage
extends Object
implements IndexStorage

A simple multiplex class to enable configuration of the storage mecahnism in sakai.properties to use indexStorageName@org.sakaiproject.search.index.IndexStorage = filesystem indexStorageName@org.sakaiproject.search.index.IndexStorage = cluster indexStorageName@org.sakaiproject.search.index.IndexStorage = db recoverCorruptedIndex@org.sakaiproject.search.index.IndexStorage = false may cahnge, and it is worth looking in the components for the real values.

Author:
ieb

Constructor Summary
SearchIndexStorage()
           
 
Method Summary
 void addReloadListener(IndexReloadListener indexReloadListener)
           
 boolean centralIndexExists()
          A fast method that checks if the index exists in the cluster without opening or loading the index.
 void closeIndexReader(org.apache.lucene.index.IndexReader indexReader)
          This will close the index reader and release any locks
 void closeIndexSearcher(org.apache.lucene.search.IndexSearcher indexSearcher)
           
 void closeIndexWriter(org.apache.lucene.index.IndexWriter indexWrite)
          this will close the index reader and release any locks
 void disableDiagnostics()
           
 void doPostIndexUpdate()
          perform all operations necessary after an update cycle
 void doPreIndexUpdate()
          perform all operations before an update cycle
 void enableDiagnostics()
           
 void forceNextReload()
           
 org.apache.lucene.analysis.Analyzer getAnalyzer()
          Get an analyzer correct for the indexer being used.
 Map getCurrentStores()
           
 IndexStorage getDefaultIndexStorage()
           
 org.apache.lucene.index.IndexReader getIndexReader()
          get an Index Reader for the IndexStorage type
 org.apache.lucene.search.IndexSearcher getIndexSearcher(boolean reload)
          get an index searcher
 String getIndexStorageName()
           
 org.apache.lucene.index.IndexWriter getIndexWriter(boolean create)
          get an index writer, and create if asked to
 long getLastLoad()
          When the index was last loaded
 long getLastLoadTime()
          The ammount of time (ms) that it took to load the index last time
 long getLastUpdate()
           
 IndexStorage getRunningIndexStorage()
           
 List getSegmentInfoList()
           
 org.apache.lucene.store.Directory getSpellDirectory()
          get the spell index directory
 boolean hasDiagnostics()
           
 boolean indexExists()
          Does the index exist
 void init()
           
 boolean isMultipleIndexers()
          Returns true if its ok to allow multiple indexers to run at the same time The index storage may manage its own locks.
 void removeReloadListener(IndexReloadListener indexReloadListener)
           
 void setCurrentStores(Map currentStores)
           
 void setDefaultIndexStorage(IndexStorage defaultIndexStorage)
           
 void setIndexStorageName(String indexStorageName)
           
 void setRecoverCorruptedIndex(boolean recover)
          if set to true the IndexStorageWill automatically attempt to recover a corrupted index Not all IndexStorage implementations can do this,
 void setRunningIndexStorage(IndexStorage runningIndexStorage)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchIndexStorage

public SearchIndexStorage()
Method Detail

init

public void init()

getIndexReader

public org.apache.lucene.index.IndexReader getIndexReader()
                                                   throws IOException
Description copied from interface: IndexStorage
get an Index Reader for the IndexStorage type

Specified by:
getIndexReader in interface IndexStorage
Returns:
Throws:
IOException

getIndexWriter

public org.apache.lucene.index.IndexWriter getIndexWriter(boolean create)
                                                   throws IOException
Description copied from interface: IndexStorage
get an index writer, and create if asked to

Specified by:
getIndexWriter in interface IndexStorage
Returns:
Throws:
IOException

doPostIndexUpdate

public void doPostIndexUpdate()
                       throws IOException
Description copied from interface: IndexStorage
perform all operations necessary after an update cycle

Specified by:
doPostIndexUpdate in interface IndexStorage
Throws:
IOException

doPreIndexUpdate

public void doPreIndexUpdate()
                      throws IOException
Description copied from interface: IndexStorage
perform all operations before an update cycle

Specified by:
doPreIndexUpdate in interface IndexStorage
Throws:
IOException

indexExists

public boolean indexExists()
Description copied from interface: IndexStorage
Does the index exist

Specified by:
indexExists in interface IndexStorage
Returns:

getAnalyzer

public org.apache.lucene.analysis.Analyzer getAnalyzer()
Description copied from interface: IndexStorage
Get an analyzer correct for the indexer being used.

Specified by:
getAnalyzer in interface IndexStorage
Returns:

getCurrentStores

public Map getCurrentStores()
Returns:
Returns the currentStores.

setCurrentStores

public void setCurrentStores(Map currentStores)
Parameters:
currentStores - The currentStores to set.

getDefaultIndexStorage

public IndexStorage getDefaultIndexStorage()
Returns:
Returns the defaultIndexStorage.

setDefaultIndexStorage

public void setDefaultIndexStorage(IndexStorage defaultIndexStorage)
Parameters:
defaultIndexStorage - The defaultIndexStorage to set.

getIndexStorageName

public String getIndexStorageName()
Returns:
Returns the indexStorageName.

setIndexStorageName

public void setIndexStorageName(String indexStorageName)
Parameters:
indexStorageName - The indexStorageName to set.

getRunningIndexStorage

public IndexStorage getRunningIndexStorage()
Returns:
Returns the runningIndexStorage.

setRunningIndexStorage

public void setRunningIndexStorage(IndexStorage runningIndexStorage)
Parameters:
runningIndexStorage - The runningIndexStorage to set.

setRecoverCorruptedIndex

public void setRecoverCorruptedIndex(boolean recover)
Description copied from interface: IndexStorage
if set to true the IndexStorageWill automatically attempt to recover a corrupted index Not all IndexStorage implementations can do this,

Specified by:
setRecoverCorruptedIndex in interface IndexStorage

getLastUpdate

public long getLastUpdate()
Specified by:
getLastUpdate in interface IndexStorage

getSegmentInfoList

public List getSegmentInfoList()
Specified by:
getSegmentInfoList in interface IndexStorage

closeIndexReader

public void closeIndexReader(org.apache.lucene.index.IndexReader indexReader)
                      throws IOException
Description copied from interface: IndexStorage
This will close the index reader and release any locks

Specified by:
closeIndexReader in interface IndexStorage
Throws:
IOException

closeIndexWriter

public void closeIndexWriter(org.apache.lucene.index.IndexWriter indexWrite)
                      throws IOException
Description copied from interface: IndexStorage
this will close the index reader and release any locks

Specified by:
closeIndexWriter in interface IndexStorage
Throws:
IOException

isMultipleIndexers

public boolean isMultipleIndexers()
Description copied from interface: IndexStorage
Returns true if its ok to allow multiple indexers to run at the same time The index storage may manage its own locks.

Specified by:
isMultipleIndexers in interface IndexStorage
Returns:

closeIndexSearcher

public void closeIndexSearcher(org.apache.lucene.search.IndexSearcher indexSearcher)
Specified by:
closeIndexSearcher in interface IndexStorage

disableDiagnostics

public void disableDiagnostics()
Specified by:
disableDiagnostics in interface Diagnosable

enableDiagnostics

public void enableDiagnostics()
Specified by:
enableDiagnostics in interface Diagnosable

hasDiagnostics

public boolean hasDiagnostics()
Specified by:
hasDiagnostics in interface Diagnosable

centralIndexExists

public boolean centralIndexExists()
Description copied from interface: IndexStorage
A fast method that checks if the index exists in the cluster without opening or loading the index. Is local, looking on local disk is enough.

Specified by:
centralIndexExists in interface IndexStorage
Returns:

addReloadListener

public void addReloadListener(IndexReloadListener indexReloadListener)
Specified by:
addReloadListener in interface IndexStorage

forceNextReload

public void forceNextReload()
Specified by:
forceNextReload in interface IndexStorage

getIndexSearcher

public org.apache.lucene.search.IndexSearcher getIndexSearcher(boolean reload)
                                                        throws IOException
Description copied from interface: IndexStorage
get an index searcher

Specified by:
getIndexSearcher in interface IndexStorage
Parameters:
reload - force a reload of the searcher, if the implementation is caching a searcher
Returns:
Throws:
IOException

getLastLoad

public long getLastLoad()
Description copied from interface: IndexStorage
When the index was last loaded

Specified by:
getLastLoad in interface IndexStorage
Returns:

getLastLoadTime

public long getLastLoadTime()
Description copied from interface: IndexStorage
The ammount of time (ms) that it took to load the index last time

Specified by:
getLastLoadTime in interface IndexStorage
Returns:

removeReloadListener

public void removeReloadListener(IndexReloadListener indexReloadListener)
Specified by:
removeReloadListener in interface IndexStorage

getSpellDirectory

public org.apache.lucene.store.Directory getSpellDirectory()
Description copied from interface: IndexStorage
get the spell index directory

Specified by:
getSpellDirectory in interface IndexStorage
Returns:


Copyright © 2003-2012 Sakai Project. All Rights Reserved.