org.compass.core.lucene.engine.transaction
Class BatchInsertTransaction

java.lang.Object
  extended by org.compass.core.lucene.engine.transaction.AbstractTransaction
      extended by org.compass.core.lucene.engine.transaction.BatchInsertTransaction
All Implemented Interfaces:
LuceneSearchEngineTransaction

public class BatchInsertTransaction
extends AbstractTransaction

A batch update transaction management. Only support save (add) operations. Find and delete operations throws an exception. The transaction is very fast when adding new resources, note that if a resource with the save id already exists, we will have two resources with the same id.

The Batch Transaction support uses Lucene directly, and the Lucene settings apply and affect greatly on the performance of the batch indexing. Among them are the LuceneEnvironment.SearchEngineIndex.MAX_BUFFERED_DOCS, LuceneEnvironment.SearchEngineIndex.MAX_MERGE_DOCS, LuceneEnvironment.SearchEngineIndex.MERGE_FACTOR.

Author:
kimchy

Nested Class Summary
static class BatchInsertTransaction.WriterManager
           
 
Field Summary
 
Fields inherited from class org.compass.core.lucene.engine.transaction.AbstractTransaction
analyzerManager, dirty, indexManager, mapping, searchEngine
 
Constructor Summary
BatchInsertTransaction()
           
 
Method Summary
protected  void doBegin()
           
protected  void doCommit(boolean onePhase)
           
protected  void doCreate(InternalResource resource)
           
protected  void doDelete(ResourceKey resourceKey)
           
protected  SearchEngineHits doFind(LuceneSearchEngineQuery query)
           
protected  SearchEngineInternalSearch doInternalSearch(String[] subIndexes, String[] aliases)
           
protected  void doPrepare()
           
protected  void doRollback()
           
 Resource[] find(ResourceKey resourceKey)
           
 void flush()
          Supported only in batch insert transacitons.
 
Methods inherited from class org.compass.core.lucene.engine.transaction.AbstractTransaction
begin, closeDelegateClosed, commit, configure, create, delete, find, getResourceMapping, internalSearch, isDirty, prepare, rollback
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BatchInsertTransaction

public BatchInsertTransaction()
Method Detail

doBegin

protected void doBegin()
                throws SearchEngineException
Specified by:
doBegin in class AbstractTransaction
Throws:
SearchEngineException

doRollback

protected void doRollback()
                   throws SearchEngineException
Specified by:
doRollback in class AbstractTransaction
Throws:
SearchEngineException

doPrepare

protected void doPrepare()
                  throws SearchEngineException
Specified by:
doPrepare in class AbstractTransaction
Throws:
SearchEngineException

doCommit

protected void doCommit(boolean onePhase)
                 throws SearchEngineException
Specified by:
doCommit in class AbstractTransaction
Throws:
SearchEngineException

flush

public void flush()
           throws SearchEngineException
Description copied from interface: LuceneSearchEngineTransaction
Supported only in batch insert transacitons.

Throws:
SearchEngineException

doCreate

protected void doCreate(InternalResource resource)
                 throws SearchEngineException
Specified by:
doCreate in class AbstractTransaction
Throws:
SearchEngineException

doDelete

protected void doDelete(ResourceKey resourceKey)
                 throws SearchEngineException
Specified by:
doDelete in class AbstractTransaction
Throws:
SearchEngineException

doFind

protected SearchEngineHits doFind(LuceneSearchEngineQuery query)
                           throws SearchEngineException
Specified by:
doFind in class AbstractTransaction
Throws:
SearchEngineException

find

public Resource[] find(ResourceKey resourceKey)
                throws SearchEngineException
Throws:
SearchEngineException

doInternalSearch

protected SearchEngineInternalSearch doInternalSearch(String[] subIndexes,
                                                      String[] aliases)
                                               throws SearchEngineException
Specified by:
doInternalSearch in class AbstractTransaction
Throws:
SearchEngineException


Copyright (c) 2004-2006 The Compass Project.