org.compass.core.lucene.engine.store
Interface LuceneSearchEngineStore

All Known Implementing Classes:
DefaultLuceneSearchEngineStore

public interface LuceneSearchEngineStore

Manages the mapping between aliases and their repective sub indexes. A Acts as an abstration layer on top of the actual Lucene Directory creation.

Author:
kimchy

Method Summary
 String[] calcSubIndexes(String[] subIndexes, String[] aliases)
          Returns the sub indexes that intersect with the given sub indexes and aliases provided.
 String[] calcSubIndexes(String[] subIndexes, String[] aliases, Class[] types)
          Returns the sub indexes the intersect with the given sub indexes and aliases provided.
 void cleanIndex(String subIndex)
          Cleans the sub index.
 void close()
          Closes the store.
 void configure(LuceneSearchEngineFactory searchEngineFactory, CompassSettings settings, CompassMapping mapping)
          Configures the store.
 void copyFrom(String subIndex, LuceneSearchEngineStore searchEngineStore)
          Copies the index from the given store into the current store.
 void copyFrom(String subContext, String subIndex, LuceneSearchEngineStore searchEngineStore)
          Copies the index from the given store into the current store.
 void createIndex()
          Creates the index (if it is already exists, delets it first).
 void deleteIndex()
          Deletes the index.
 void deleteIndex(String subIndex)
          Deletes the index for the given sub index.
 void deleteIndex(String subContext, String subIndex)
          Deletes the index for the given sub context and sub index.
 String[] getAliasesBySubIndex(String subIndex)
          Returns the list of aliases that are mapped for a given sub index.
 String getDefaultSubContext()
          Returns the default sub context associated with this store.
 int getNumberOfAliasesBySubIndex(String subIndex)
          Returns the number of aliases that map to the given sub index.
 String[] getSubIndexes()
          Returns all the sub indexes defined within the store.
 boolean indexExists()
          Returns true if one of the sub indexes index does exists.
 boolean indexExists(String subIndex)
          Returns true if the sub index index does exists as a legal Lucene index.
 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 isUseCompoundFile()
          Should we use the compound file format or not.
 Directory openDirectory(String subIndex)
          Returns the directory that match the given sub index.
 Directory openDirectory(String subContext, String subIndex)
          Returns the directory that match the given sub index.
 void performScheduledTasks()
          Performs any scheduled tasks, managed by the index manager.
 String[] polyCalcSubIndexes(String[] subIndexes, String[] aliases, Class[] types)
          Returns the sub indexes that intersect with the given sub indexes, aliases and types.
 void registerEventListeners(SearchEngine searchEngine, SearchEngineEventManager eventManager)
          A callback to register event listeners when a SearchEngine is created.
 void releaseLock(String subIndex)
          Releases the lock for the given sub index.
 void releaseLocks()
          Releases all the locks on all the sub indexes.
 boolean requiresAsyncTransactionalContext()
          Returns true if a transaction needs to be started when performing operations with this store.
 boolean subIndexExists(String subIndex)
          Returns true if the sub index exists.
 String suggestedIndexDeletionPolicy()
          Returns the suggested index deletion policy for the given store.
 boolean supportsConcurrentOperations()
          Returns true if this store supports concurrent operations.
 boolean verifyIndex()
          Verify that the index exists.
 

Method Detail

configure

void configure(LuceneSearchEngineFactory searchEngineFactory,
               CompassSettings settings,
               CompassMapping mapping)
Configures the store.


close

void close()
Closes the store.


performScheduledTasks

void performScheduledTasks()
Performs any scheduled tasks, managed by the index manager.


getSubIndexes

String[] getSubIndexes()
Returns all the sub indexes defined within the store.


subIndexExists

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


getNumberOfAliasesBySubIndex

int getNumberOfAliasesBySubIndex(String subIndex)
Returns the number of aliases that map to the given sub index.


getAliasesBySubIndex

String[] getAliasesBySubIndex(String subIndex)
Returns the list of aliases that are mapped for a given sub index.


openDirectory

Directory openDirectory(String subIndex)
                        throws SearchEngineException
Returns the directory that match the given sub index.

Throws:
SearchEngineException

openDirectory

Directory openDirectory(String subContext,
                        String subIndex)
                        throws SearchEngineException
Returns the directory that match the given sub index.

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

deleteIndex

void deleteIndex()
                 throws SearchEngineException
Deletes the index.

Throws:
SearchEngineException

deleteIndex

void deleteIndex(String subIndex)
                 throws SearchEngineException
Deletes the index for the given sub index.

Throws:
SearchEngineException

deleteIndex

void deleteIndex(String subContext,
                 String subIndex)
                 throws SearchEngineException
Deletes the index for the given sub context and sub index.

Throws:
SearchEngineException

cleanIndex

void cleanIndex(String subIndex)
                throws SearchEngineException
Cleans the sub index.

Throws:
SearchEngineException

createIndex

void createIndex()
                 throws SearchEngineException
Creates the index (if it is already exists, delets it first).

Throws:
SearchEngineException

verifyIndex

boolean verifyIndex()
                    throws SearchEngineException
Verify that the index exists. If the index exists, nothing happens, if it does not, the index is created.

Throws:
SearchEngineException

indexExists

boolean indexExists()
                    throws SearchEngineException
Returns true if one of the sub indexes index does exists.

Throws:
SearchEngineException

indexExists

boolean indexExists(String subIndex)
                    throws SearchEngineException
Returns true if the sub index index does exists as a legal Lucene index.

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.


calcSubIndexes

String[] calcSubIndexes(String[] subIndexes,
                        String[] aliases)
Returns the sub indexes that intersect with the given sub indexes and aliases provided. If the sub indexes and aliases are null, return all the sub indexes.


copyFrom

void copyFrom(String subContext,
              String subIndex,
              LuceneSearchEngineStore searchEngineStore)
              throws SearchEngineException
Copies the index from the given store into the current store.

Throws:
SearchEngineException

copyFrom

void copyFrom(String subIndex,
              LuceneSearchEngineStore searchEngineStore)
              throws SearchEngineException
Copies the index from the given store into the current store.

Throws:
SearchEngineException

getDefaultSubContext

String getDefaultSubContext()
Returns the default sub context associated with this store.


registerEventListeners

void registerEventListeners(SearchEngine searchEngine,
                            SearchEngineEventManager eventManager)
A callback to register event listeners when a SearchEngine is created.

Parameters:
searchEngine - The search engine created
eventManager - The event manager to register events with

requiresAsyncTransactionalContext

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


supportsConcurrentOperations

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


isUseCompoundFile

boolean isUseCompoundFile()
Should we use the compound file format or not.


suggestedIndexDeletionPolicy

String suggestedIndexDeletionPolicy()
Returns the suggested index deletion policy for the given store. Will be applied if not explicitly configured. Can return null if globabl settings should be applied.



Copyright (c) 2004-2008 The Compass Project.