Package org.apache.solr.update
Class UpdateHandler
- java.lang.Object
-
- org.apache.solr.update.UpdateHandler
-
- All Implemented Interfaces:
SolrInfoBean
- Direct Known Subclasses:
DirectUpdateHandler2
public abstract class UpdateHandler extends Object implements SolrInfoBean
UpdateHandler
handles requests to change the index (adds, deletes, commits, optimizes, etc).- Since:
- solr 0.9
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.solr.core.SolrInfoBean
SolrInfoBean.Category, SolrInfoBean.Group
-
-
Field Summary
Fields Modifier and Type Field Description protected Vector<SolrEventListener>
commitCallbacks
protected SolrCore
core
protected SchemaField
idField
protected FieldType
idFieldType
protected Set<String>
metricNames
protected Vector<SolrEventListener>
optimizeCallbacks
protected com.codahale.metrics.MetricRegistry
registry
protected Vector<SolrEventListener>
softCommitCallbacks
protected UpdateLog
ulog
-
Constructor Summary
Constructors Constructor Description UpdateHandler(SolrCore core)
UpdateHandler(SolrCore core, UpdateLog updateLog)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract int
addDoc(AddUpdateCommand cmd)
protected void
callPostCommitCallbacks()
protected void
callPostOptimizeCallbacks()
protected void
callPostSoftCommitCallbacks()
abstract void
close()
abstract void
commit(CommitUpdateCommand cmd)
abstract void
delete(DeleteUpdateCommand cmd)
abstract void
deleteByQuery(DeleteUpdateCommand cmd)
SolrInfoBean.Category
getCategory()
Category of this componentSet<String>
getMetricNames()
Modifiable set of metric names that this component reports (default is null, which means none).com.codahale.metrics.MetricRegistry
getMetricRegistry()
An instance ofMetricRegistry
that this component uses for metrics reporting (default is null, which means no registry).abstract SolrCoreState
getSolrCoreState()
abstract UpdateLog
getUpdateLog()
void
informEventListeners(SolrCore core)
Call theSolrCoreAware.inform(SolrCore)
on all the applicable registered listeners.abstract int
mergeIndexes(MergeIndexesCommand cmd)
abstract void
newIndexWriter(boolean rollback)
Called when the Writer should be opened again - eg when replication replaces all of the index files.void
registerCommitCallback(SolrEventListener listener)
NOTE: this function is not thread safe.void
registerOptimizeCallback(SolrEventListener listener)
NOTE: this function is not thread safe.void
registerSoftCommitCallback(SolrEventListener listener)
NOTE: this function is not thread safe.abstract void
rollback(RollbackUpdateCommand cmd)
abstract void
split(SplitIndexCommand 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.SolrInfoBean
getDescription, getMetricsSnapshot, getName, registerMetricName
-
-
-
-
Field Detail
-
core
protected final SolrCore core
-
idField
protected final SchemaField idField
-
idFieldType
protected final FieldType idFieldType
-
commitCallbacks
protected Vector<SolrEventListener> commitCallbacks
-
softCommitCallbacks
protected Vector<SolrEventListener> softCommitCallbacks
-
optimizeCallbacks
protected Vector<SolrEventListener> optimizeCallbacks
-
ulog
protected final UpdateLog ulog
-
registry
protected com.codahale.metrics.MetricRegistry registry
-
-
Method Detail
-
informEventListeners
public void informEventListeners(SolrCore core)
Call theSolrCoreAware.inform(SolrCore)
on all the applicable registered listeners.
-
callPostCommitCallbacks
protected void callPostCommitCallbacks()
-
callPostSoftCommitCallbacks
protected void callPostSoftCommitCallbacks()
-
callPostOptimizeCallbacks
protected void callPostOptimizeCallbacks()
-
newIndexWriter
public abstract void newIndexWriter(boolean rollback) throws IOException
Called when the Writer should be opened again - eg when replication replaces all of the index files.- Parameters:
rollback
- IndexWriter if true else close- Throws:
IOException
- If there is a low-level I/O error.
-
getSolrCoreState
public abstract SolrCoreState getSolrCoreState()
-
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
-
getUpdateLog
public abstract UpdateLog getUpdateLog()
-
registerCommitCallback
public void registerCommitCallback(SolrEventListener listener)
NOTE: this function is not thread safe. However, it is safe to call within theinform( SolrCore core )
function forSolrCoreAware
classes. Outsideinform
, this could potentially throw a ConcurrentModificationException- See Also:
SolrCoreAware
-
registerSoftCommitCallback
public void registerSoftCommitCallback(SolrEventListener listener)
NOTE: this function is not thread safe. However, it is safe to call within theinform( SolrCore core )
function forSolrCoreAware
classes. Outsideinform
, 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 theinform( SolrCore core )
function forSolrCoreAware
classes. Outsideinform
, this could potentially throw a ConcurrentModificationException- See Also:
SolrCoreAware
-
split
public abstract void split(SplitIndexCommand cmd) throws IOException
- Throws:
IOException
-
getCategory
public SolrInfoBean.Category getCategory()
Description copied from interface:SolrInfoBean
Category of this component- Specified by:
getCategory
in interfaceSolrInfoBean
-
getMetricNames
public Set<String> getMetricNames()
Description copied from interface:SolrInfoBean
Modifiable set of metric names that this component reports (default is null, which means none). If not null then this set is used bySolrInfoBean.registerMetricName(String)
to capture what metrics names are reported from this component.NOTE: this set has to allow iteration under modifications.
- Specified by:
getMetricNames
in interfaceSolrInfoBean
-
getMetricRegistry
public com.codahale.metrics.MetricRegistry getMetricRegistry()
Description copied from interface:SolrInfoBean
An instance ofMetricRegistry
that this component uses for metrics reporting (default is null, which means no registry).- Specified by:
getMetricRegistry
in interfaceSolrInfoBean
-
-