org.apache.solr.update
Class UpdateHandler

java.lang.Object
  extended by org.apache.solr.update.UpdateHandler
All Implemented Interfaces:
SolrInfoMBean
Direct Known Subclasses:
DirectUpdateHandler, DirectUpdateHandler2

public abstract class UpdateHandler
extends Object
implements SolrInfoMBean

UpdateHandler handles requests to change the index (adds, deletes, commits, optimizes, etc).

Since:
solr 0.9
Version:
$Id: UpdateHandler.java 1305693 2012-03-27 00:43:47Z janhoy $

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.solr.core.SolrInfoMBean
SolrInfoMBean.Category
 
Field Summary
protected  Vector<SolrEventListener> commitCallbacks
           
protected  SolrCore core
           
protected  SchemaField idField
           
protected  FieldType idFieldType
           
protected  Term idTerm
           
protected static org.slf4j.Logger log
           
protected  Vector<SolrEventListener> optimizeCallbacks
           
protected  IndexSchema schema
           
 
Constructor Summary
UpdateHandler(SolrCore core)
           
 
Method Summary
abstract  int addDoc(AddUpdateCommand cmd)
           
protected  void callPostCommitCallbacks()
           
protected  void callPostOptimizeCallbacks()
           
abstract  void close()
           
abstract  void commit(CommitUpdateCommand cmd)
           
protected  SolrIndexWriter createMainIndexWriter(String name, boolean removeAllExisting)
           
abstract  void delete(DeleteUpdateCommand cmd)
           
abstract  void deleteByQuery(DeleteUpdateCommand cmd)
           
protected  String getIndexedId(Document doc)
           
protected  String getIndexedIdOptional(Document doc)
           
protected  Term idTerm(String readableId)
           
abstract  int mergeIndexes(MergeIndexesCommand cmd)
           
 void registerCommitCallback(SolrEventListener listener)
          NOTE: this function is not thread safe.
 void registerOptimizeCallback(SolrEventListener listener)
          NOTE: this function is not thread safe.
abstract  void rollback(RollbackUpdateCommand cmd)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.solr.core.SolrInfoMBean
getCategory, getDescription, getDocs, getName, getSource, getSourceId, getStatistics, getVersion
 

Field Detail

log

protected static final org.slf4j.Logger log

core

protected final SolrCore core

schema

protected final IndexSchema schema

idField

protected final SchemaField idField

idFieldType

protected final FieldType idFieldType

idTerm

protected final Term idTerm

commitCallbacks

protected Vector<SolrEventListener> commitCallbacks

optimizeCallbacks

protected Vector<SolrEventListener> optimizeCallbacks
Constructor Detail

UpdateHandler

public UpdateHandler(SolrCore core)
Method Detail

callPostCommitCallbacks

protected void callPostCommitCallbacks()

callPostOptimizeCallbacks

protected void callPostOptimizeCallbacks()

createMainIndexWriter

protected SolrIndexWriter createMainIndexWriter(String name,
                                                boolean removeAllExisting)
                                         throws IOException
Throws:
IOException

idTerm

protected final Term idTerm(String readableId)

getIndexedId

protected final String getIndexedId(Document doc)

getIndexedIdOptional

protected final String getIndexedIdOptional(Document doc)

addDoc

public abstract int addDoc(AddUpdateCommand cmd)
                    throws IOException
Throws:
IOException

delete

public abstract void delete(DeleteUpdateCommand cmd)
                     throws IOException
Throws:
IOException

deleteByQuery

public abstract void deleteByQuery(DeleteUpdateCommand cmd)
                            throws IOException
Throws:
IOException

mergeIndexes

public abstract int mergeIndexes(MergeIndexesCommand cmd)
                          throws IOException
Throws:
IOException

commit

public abstract void commit(CommitUpdateCommand cmd)
                     throws IOException
Throws:
IOException

rollback

public abstract void rollback(RollbackUpdateCommand cmd)
                       throws IOException
Throws:
IOException

close

public abstract void close()
                    throws IOException
Throws:
IOException

registerCommitCallback

public void registerCommitCallback(SolrEventListener listener)
NOTE: this function is not thread safe. However, it is safe to call within the inform( SolrCore core ) function for SolrCoreAware classes. Outside inform, this could potentially throw a ConcurrentModificationException

See Also:
SolrCoreAware

registerOptimizeCallback

public void registerOptimizeCallback(SolrEventListener listener)
NOTE: this function is not thread safe. However, it is safe to call within the inform( SolrCore core ) function for SolrCoreAware classes. Outside inform, this could potentially throw a ConcurrentModificationException

See Also:
SolrCoreAware