org.compass.core.engine
Interface SearchEngineIndexManager

All Known Subinterfaces:
LuceneSearchEngineIndexManager
All Known Implementing Classes:
DefaultLuceneSearchEngineIndexManager

public interface SearchEngineIndexManager

Author:
kimchy

Nested Class Summary
static interface SearchEngineIndexManager.IndexOperationCallback
          A callback interface that works with.
static interface SearchEngineIndexManager.IndexOperationPlan
           
static interface SearchEngineIndexManager.ReplaceIndexCallback
          A callback to replace the current index.
 
Method Summary
 String[] calcSubIndexes(String[] subIndexes, String[] aliases, Class[] types)
          Returns the sub indexes the intersect with the given sub indexes and aliases provided.
 void checkAndClearIfNotifiedAllToClearCache()
          Manual check if the notified to clear the cache globally.
 void cleanIndex()
          Cleans the index from data (by deleting and creating an empty one).
 void cleanIndex(String subIndex)
          Cleans the index from data (by deleting and creating an empty one).
 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.
 String[] getSubIndexes()
          Returns the sub indexes that Compass handles.
 boolean indexExists()
          Returns true if the index exists.
 void invalidateCache()
          Invalidates any internal caching done by the index.
 void invalidateCache(String subIndex)
          Invalidates any internal caching done by the index for the specified sub-index.
 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 one of the sub indexes is locked.
 boolean isLocked(String subIndex)
          Returns true if the given sub index is locked.
 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 performScheduledTasks()
          Performs scheduled tasks that are usually derived basde on the actual index storage used.
 String[] polyCalcSubIndexes(String[] subIndexes, String[] aliases, Class[] types)
          Returns the sub indexes that intersect with the given sub indexes, aliases and types.
 void refreshCache()
          Refresh any internal caching done by the index.
 void refreshCache(String subIndex)
          Refresh any internal caching done by the index for the specified sub-index.
 void releaseLock(String subIndex)
          Releases a lock for the given sub index.
 void releaseLocks()
          Releases all the locks held over all the possbile 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.
 boolean requiresAsyncTransactionalContext()
          Returns true if a transaction needs to be started when performing operations with this store.
 void start()
          Starts the index manager
 void stop()
          Stops / closes the index manager
 boolean subIndexExists(String subIndex)
          Returns true if the sub index exists.
 boolean supportsConcurrentCommits()
          Returns true if the index store supports concurrent commits.
 boolean supportsConcurrentOperations()
          Returns true if the index store supports concurrent operations.
 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.

Throws:
SearchEngineException

cleanIndex

void cleanIndex()
                throws SearchEngineException
Cleans the index from data (by deleting and creating an empty one).

Throws:
SearchEngineException

cleanIndex

void cleanIndex(String subIndex)
                throws SearchEngineException
Cleans the index from data (by deleting and creating an empty one).

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. Closes any cached resources.

Throws:
SearchEngineException

clearCache

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

Throws:
SearchEngineException

invalidateCache

void invalidateCache(String subIndex)
                     throws SearchEngineException
Invalidates any internal caching done by the index for the specified sub-index. More lightweight than clearCache(String).

Throws:
SearchEngineException

invalidateCache

void invalidateCache()
                     throws SearchEngineException
Invalidates any internal caching done by the index. More lightweight than clearCache().

Throws:
SearchEngineException

refreshCache

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

Throws:
SearchEngineException

refreshCache

void refreshCache()
                  throws SearchEngineException
Refresh 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

performScheduledTasks

void performScheduledTasks()
                           throws SearchEngineException
Performs scheduled tasks that are usually derived basde on the actual index storage used.

This API will be called when disabling the automatic scheduler that comes built in with Compass.

Throws:
SearchEngineException

getSubIndexes

String[] getSubIndexes()
Returns the sub indexes that Compass handles.


subIndexExists

boolean subIndexExists(String subIndex)
Returns true if the sub index exists.


releaseLocks

void releaseLocks()
                  throws SearchEngineException
Releases all the locks held over all the possbile sub indexes.

Throws:
SearchEngineException

releaseLock

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

Throws:
SearchEngineException

isLocked

boolean isLocked()
                 throws SearchEngineException
Returns true if one of the sub indexes is locked.

Throws:
SearchEngineException

isLocked

boolean isLocked(String subIndex)
                 throws SearchEngineException
Returns true if the given sub index is locked.

Throws:
SearchEngineException

calcSubIndexes

String[] calcSubIndexes(String[] subIndexes,
                        String[] aliases,
                        Class[] types)
Returns the sub indexes the intersect with the given sub indexes and aliases provided. The types are translated to aliases and retuned as well.


polyCalcSubIndexes

String[] polyCalcSubIndexes(String[] subIndexes,
                            String[] aliases,
                            Class[] types)
Returns the sub indexes that intersect with the given sub indexes, aliases and types. Types are translated to the matching aliases. Any extending aliases of the given aliases (or types) are added as well.


requiresAsyncTransactionalContext

boolean requiresAsyncTransactionalContext()
Returns true if a transaction needs to be started when performing operations with this store.


supportsConcurrentOperations

boolean supportsConcurrentOperations()
Returns true if the index store supports concurrent operations.


supportsConcurrentCommits

boolean supportsConcurrentCommits()
Returns true if the index store supports concurrent commits.



Copyright (c) 2004-2009 The Compass Project.