org.compass.core.engine
Interface SearchEngineIndexManager

All Known Subinterfaces:
LuceneSearchEngineIndexManager
All Known Implementing Classes:
DefaultLuceneSearchEngineIndexManager, ScheduledLuceneSearchEngineIndexManager

public interface SearchEngineIndexManager

Author:
kimchy

Nested Class Summary
static interface SearchEngineIndexManager.IndexOperationCallback
          A callback interface that works with.
static interface SearchEngineIndexManager.ReplaceIndexCallback
          A callback to replace the current index.
 
Method Summary
 void checkAndClearIfNotifiedAllToClearCache()
          Manual check if the notified to clear the cache globally.
 void clearCache()
          Clears any internal caching done by the index.
 void clearCache(String subIndex)
          Clears any internal caching done by the index for the specified sub-index.
 void close()
          Closes the index manager.
 void createIndex()
          Creates an index data.
 void deleteIndex()
          Deletes the index data.
 boolean indexExists()
          Returns true if the index exists.
 boolean isCached()
          Returns true if one of the sub indexes is cached.
 boolean isCached(String subIndex)
          Returns true if the sub index is cached.
 boolean isLocked()
          Returns true if any sub index is locked.
 boolean isLocked(String subIndex)
          Returns true if the sub index is locked (both Lucene write and commit locks).
 boolean isRunning()
          Returns true if the index manage is running
 void notifyAllToClearCache()
          Notifies all the compass instances that are working with the same index to clear cache.
 void operate(SearchEngineIndexManager.IndexOperationCallback callback)
          A general api for index operations.
 void releaseLock(String subIndex)
          Releases the lock for the given sub index.
 void releaseLocks()
          Releases all the locks on all the sub indexes.
 void replaceIndex(SearchEngineIndexManager indexManager, SearchEngineIndexManager.ReplaceIndexCallback callback)
          Replaces the index data that is used by the current instance, with the one that is pointed by the given indexManager.
 void start()
          Starts the index manager
 void stop()
          Stops / closes the index manager
 boolean verifyIndex()
          Verify the index data.
 

Method Detail

start

void start()
Starts the index manager


stop

void stop()
Stops / closes the index manager


isRunning

boolean isRunning()
Returns true if the index manage is running


close

void close()
Closes the index manager. Used by compass, probably not a good idea to call it.


createIndex

void createIndex()
                 throws SearchEngineException
Creates an index data. If exists, deletes it and creates a new one.

Throws:
SearchEngineException

verifyIndex

boolean verifyIndex()
                    throws SearchEngineException
Verify the index data. If exists, does nothing. If it doesn't exists, creates it. Returns true if the index was created. If the index exists, and it's LuceneEnvironment.SearchEngineIndex.USE_COMPOUND_FILE changed it's settings, will compound / un-compound the index accordingly.

Throws:
SearchEngineException

deleteIndex

void deleteIndex()
                 throws SearchEngineException
Deletes the index data.

Throws:
SearchEngineException

indexExists

boolean indexExists()
                    throws SearchEngineException
Returns true if the index exists.

Throws:
SearchEngineException

operate

void operate(SearchEngineIndexManager.IndexOperationCallback callback)
             throws SearchEngineException
A general api for index operations. Provides the ability to perform safe operations using the SearchEngineIndexManager.IndexOperationCallback.

Throws:
SearchEngineException

replaceIndex

void replaceIndex(SearchEngineIndexManager indexManager,
                  SearchEngineIndexManager.ReplaceIndexCallback callback)
                  throws SearchEngineException
Replaces the index data that is used by the current instance, with the one that is pointed by the given indexManager. A callback interface can be registered if the index is dynamically created.

The replace process is safe, in terms that it will aquire dirty locks and read locks, so the index can be safely replaced while it is being used.

Throws:
SearchEngineException

isCached

boolean isCached(String subIndex)
                 throws SearchEngineException
Returns true if the sub index is cached.

Throws:
SearchEngineException

isCached

boolean isCached()
                 throws SearchEngineException
Returns true if one of the sub indexes is cached.

Throws:
SearchEngineException

clearCache

void clearCache(String subIndex)
                throws SearchEngineException
Clears any internal caching done by the index for the specified sub-index.

Throws:
SearchEngineException

clearCache

void clearCache()
                throws SearchEngineException
Clears any internal caching done by the index.

Throws:
SearchEngineException

notifyAllToClearCache

void notifyAllToClearCache()
                           throws SearchEngineException
Notifies all the compass instances that are working with the same index to clear cache.

Throws:
SearchEngineException

checkAndClearIfNotifiedAllToClearCache

void checkAndClearIfNotifiedAllToClearCache()
                                            throws SearchEngineException
Manual check if the notified to clear the cache globally. If it does, will clear the cache.

Throws:
SearchEngineException

isLocked

boolean isLocked()
                 throws SearchEngineException
Returns true if any sub index is locked.

Throws:
SearchEngineException

isLocked

boolean isLocked(String subIndex)
                 throws SearchEngineException
Returns true if the sub index is locked (both Lucene write and commit locks).

Throws:
SearchEngineException

releaseLocks

void releaseLocks()
                  throws SearchEngineException
Releases all the locks on all the sub indexes.

Throws:
SearchEngineException

releaseLock

void releaseLock(String subIndex)
                 throws SearchEngineException
Releases the lock for the given sub index.

Throws:
SearchEngineException


Copyright (c) 2004-2006 The Compass Project.