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
dirty
 
Constructor Summary
BatchInsertTransaction()
           
 
Method Summary
protected  void doBegin()
           
protected  void doCommit(boolean onePhase)
           
protected  void doCreate(Resource resource)
           
protected  void doDelete(Property[] ids, String alias)
           
protected  SearchEngineHits doFind(LuceneSearchEngineQuery query)
           
protected  SearchEngineHighlighter doHighlighter(LuceneSearchEngineQuery query)
           
protected  void doPrepare()
           
protected  void doRollback()
           
 Resource[] find(Property[] ids, String alias)
           
 void flush()
          Supported only in batch insert transacitons.
 LuceneTermInfoVector getTermInfo(LuceneResource resource, String propertyName)
           
 LuceneTermInfoVector[] getTermInfos(LuceneResource resource)
           
 
Methods inherited from class org.compass.core.lucene.engine.transaction.AbstractTransaction
begin, closeHits, commit, configure, create, delete, find, getAnalyzerManager, getIndexManager, getMapping, getResourceMapping, getSearchEngine, highlighter, 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(Resource resource)
                 throws SearchEngineException
Specified by:
doCreate in class AbstractTransaction
Throws:
SearchEngineException

doDelete

protected void doDelete(Property[] ids,
                        String alias)
                 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(Property[] ids,
                       String alias)
                throws SearchEngineException
Throws:
SearchEngineException

doHighlighter

protected SearchEngineHighlighter doHighlighter(LuceneSearchEngineQuery query)
                                         throws SearchEngineException
Specified by:
doHighlighter in class AbstractTransaction
Throws:
SearchEngineException

getTermInfo

public LuceneTermInfoVector getTermInfo(LuceneResource resource,
                                        String propertyName)

getTermInfos

public LuceneTermInfoVector[] getTermInfos(LuceneResource resource)


Copyright (c) 2004-2006 The Compass Project.