org.sakaiproject.search.index.impl
Class ClusterFSIndexStorage

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

public class ClusterFSIndexStorage
extends BaseIndexStorage

Implementation of IndexStorage using a Cluster File system. This implementation performs all index write operations in a new temporary segment. On completion of the index operation it is merged with the current segment. If the current segment is larger than the threshold, a new segment is created. Managing the segments and how they relate to the cluster is delegated to the ClusterFilesystem

Author:
ieb

Field Summary
 
Fields inherited from class org.sakaiproject.search.index.impl.BaseIndexStorage
diagnostics
 
Constructor Summary
ClusterFSIndexStorage()
           
 
Method Summary
 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 doPostIndexUpdate()
          perform all operations necessary after an update cycle
 void doPreIndexUpdate()
          perform all operations before an update cycle
 ClusterFilesystem getClusterFS()
           
 org.apache.lucene.index.IndexReader getIndexReader()
          get an Index Reader for the IndexStorage type
protected  org.apache.lucene.search.IndexSearcher getIndexSearcher()
           
 org.apache.lucene.index.IndexWriter getIndexWriter(boolean create)
          get an index writer, and create if asked to
 long getLastUpdate()
           
 long getMaxMegeSegmentSize()
           
 long getMaxSegmentSize()
           
 List getSegmentInfoList()
           
 long getSegmentThreshold()
           
 org.apache.lucene.store.Directory getSpellDirectory()
          get the spell index directory
 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 setClusterFS(ClusterFilesystem clusterFS)
           
 void setMaxMegeSegmentSize(long maxMegeSegmentSize)
           
 void setMaxSegmentSize(long maxSegmentSize)
           
 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 setSegmentThreshold(long segmentThreshold)
           
 
Methods inherited from class org.sakaiproject.search.index.impl.BaseIndexStorage
addReloadListener, disableDiagnostics, enableDiagnostics, fireIndexReload, forceNextReload, getAnalyzer, getAnalyzerFactory, getIndexSearcher, getLastLoad, getLastLoadTime, hasDiagnostics, removeReloadListener, setAnalyzerFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClusterFSIndexStorage

public ClusterFSIndexStorage()
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

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

Returns:
Throws:
IOException

getIndexSearcher

protected org.apache.lucene.search.IndexSearcher getIndexSearcher()
                                                           throws IOException
Specified by:
getIndexSearcher in class BaseIndexStorage
Returns:
Throws:
IOException

indexExists

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

Returns:

doPreIndexUpdate

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

Throws:
IOException

doPostIndexUpdate

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

Throws:
IOException

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,


getClusterFS

public ClusterFilesystem getClusterFS()
Returns:
Returns the clusterFS.

setClusterFS

public void setClusterFS(ClusterFilesystem clusterFS)
Parameters:
clusterFS - The clusterFS to set.

getLastUpdate

public long getLastUpdate()

getSegmentInfoList

public List getSegmentInfoList()

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

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

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.

Returns:

closeIndexSearcher

public void closeIndexSearcher(org.apache.lucene.search.IndexSearcher indexSearcher)

getMaxMegeSegmentSize

public long getMaxMegeSegmentSize()
Returns:
the maxMegeSegmentSize

setMaxMegeSegmentSize

public void setMaxMegeSegmentSize(long maxMegeSegmentSize)
Parameters:
maxMegeSegmentSize - the maxMegeSegmentSize to set

getMaxSegmentSize

public long getMaxSegmentSize()
Returns:
the maxSegmentSize

setMaxSegmentSize

public void setMaxSegmentSize(long maxSegmentSize)
Parameters:
maxSegmentSize - the maxSegmentSize to set

getSegmentThreshold

public long getSegmentThreshold()
Returns:
the segmentThreshold

setSegmentThreshold

public void setSegmentThreshold(long segmentThreshold)
Parameters:
segmentThreshold - the segmentThreshold to set

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.

Returns:

getSpellDirectory

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

Returns:


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