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

All Known Implementing Classes:
AbstractLuceneSearchEngineStore, FSLuceneSearchEngineStore, JdbcLuceneSearchEngineStore, MMapLuceneSearchEngineStore, RAMLuceneSearchEngineStore

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

Nested Class Summary
static interface LuceneSearchEngineStore.LuceneStoreCallback
           
 
Method Summary
 String[] calcSubIndexes(String[] subIndexes, String[] aliases)
          Returns the sub indexes that intersect with the given sub indexes and aliases provided.
 void close()
          Closes the store.
 void closeDirectory(String subIndex, Directory dir)
          Closes the given directory.
 void configure(LuceneSearchEngineFactory searchEngineFactory, CompassSettings settings, CompassMapping mapping)
          Configures the store.
 void copyFrom(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.
 Directory getDirectoryBySubIndex(String subIndex, boolean create)
          Returns the directory that match the given sub index.
 LuceneSettings getLuceneSettings()
          Returns the lucene settings.
 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 not exists.
 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).
 void performScheduledTasks()
          Performs any scheduled tasks, managed by the index manager.
 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 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.


getNumberOfAliasesBySubIndex

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


closeDirectory

void closeDirectory(String subIndex,
                    Directory dir)
                    throws SearchEngineException
Closes the given directory.

Throws:
SearchEngineException

getDirectoryBySubIndex

Directory getDirectoryBySubIndex(String subIndex,
                                 boolean create)
                                 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

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 not exists.

Throws:
SearchEngineException

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(LuceneSearchEngineStore searchEngineStore)
              throws SearchEngineException
Copies the index from the given store into the current store.

Parameters:
searchEngineStore - The store to copy from
Throws:
SearchEngineException

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

getLuceneSettings

LuceneSettings getLuceneSettings()
Returns the lucene settings.



Copyright (c) 2004-2006 The Compass Project.