Package org.apache.solr.update
Class DirectUpdateHandler2
- java.lang.Object
- 
- org.apache.solr.update.UpdateHandler
- 
- org.apache.solr.update.DirectUpdateHandler2
 
 
- 
- All Implemented Interfaces:
- AutoCloseable,- SolrInfoBean,- SolrMetricProducer,- SolrCoreState.IndexWriterCloser
 
 public class DirectUpdateHandler2 extends UpdateHandler implements SolrCoreState.IndexWriterCloser, SolrMetricProducer DirectUpdateHandler2implements an UpdateHandler where documents are added directly to the main Lucene index as opposed to adding to a separate smaller index.
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface org.apache.solr.core.SolrInfoBeanSolrInfoBean.Category, SolrInfoBean.Group
 
- 
 - 
Field SummaryFields Modifier and Type Field Description protected CommitTrackercommitTrackerprotected booleancommitWithinSoftCommitprotected CommitTrackersoftCommitTrackerprotected SolrCoreStatesolrCoreState- 
Fields inherited from class org.apache.solr.update.UpdateHandlercommitCallbacks, core, idField, idFieldType, optimizeCallbacks, softCommitCallbacks, solrMetricsContext, ulog
 
- 
 - 
Constructor SummaryConstructors Constructor Description DirectUpdateHandler2(SolrCore core)DirectUpdateHandler2(SolrCore core, UpdateHandler updateHandler)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description intaddDoc(AddUpdateCommand cmd)voidclearIndex()voidclose()Implementations should always callSolrMetricProducer.super.close()to ensure that metrics with the same life-cycle as this component are properly unregistered.voidcloseWriter(org.apache.lucene.index.IndexWriter writer)voidcommit(CommitUpdateCommand cmd)voiddelete(DeleteUpdateCommand cmd)voiddeleteByQuery(DeleteUpdateCommand cmd)CommitTrackergetCommitTracker()StringgetDescription()Simple one or two line descriptionStringgetName()Simple common usage name, e.g.CommitTrackergetSoftCommitTracker()SolrCoreStategetSolrCoreState()UpdateLoggetUpdateLog()voidinitializeMetrics(SolrMetricsContext parentContext, String scope)Initialize metrics specific to this producer.intmergeIndexes(MergeIndexesCommand cmd)voidnewIndexWriter(boolean rollback)Called when the Writer should be opened again - eg when replication replaces all of the index files.voidprepareCommit(CommitUpdateCommand cmd)voidrollback(RollbackUpdateCommand cmd)protected voidrollbackWriter()voidsplit(SplitIndexCommand cmd)- 
Methods inherited from class org.apache.solr.update.UpdateHandlercallPostCommitCallbacks, callPostOptimizeCallbacks, callPostSoftCommitCallbacks, getCategory, getSolrMetricsContext, informEventListeners, registerCommitCallback, registerOptimizeCallback, registerSoftCommitCallback
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.apache.solr.metrics.SolrMetricProducergetSolrMetricsContext
 
- 
 
- 
- 
- 
Field Detail- 
solrCoreStateprotected final SolrCoreState solrCoreState 
 - 
commitTrackerprotected final CommitTracker commitTracker 
 - 
softCommitTrackerprotected final CommitTracker softCommitTracker 
 - 
commitWithinSoftCommitprotected boolean commitWithinSoftCommit 
 
- 
 - 
Constructor Detail- 
DirectUpdateHandler2public DirectUpdateHandler2(SolrCore core) 
 - 
DirectUpdateHandler2public DirectUpdateHandler2(SolrCore core, UpdateHandler updateHandler) 
 
- 
 - 
Method Detail- 
initializeMetricspublic void initializeMetrics(SolrMetricsContext parentContext, String scope) Description copied from interface:SolrMetricProducerInitialize metrics specific to this producer.- Specified by:
- initializeMetricsin interface- SolrMetricProducer
- Parameters:
- parentContext- parent metrics context. If this component has the same life-cycle as the parent it can simply use the parent context, otherwise it should obtain a child context using- SolrMetricsContext.getChildContext(Object)passing- thisas the child object.
- scope- component scope
 
 - 
rollbackWriterprotected void rollbackWriter() throws IOException- Throws:
- IOException
 
 - 
addDocpublic int addDoc(AddUpdateCommand cmd) throws IOException - Specified by:
- addDocin class- UpdateHandler
- Throws:
- IOException
 
 - 
deletepublic void delete(DeleteUpdateCommand cmd) throws IOException - Specified by:
- deletein class- UpdateHandler
- Throws:
- IOException
 
 - 
clearIndexpublic void clearIndex() throws IOException- Throws:
- IOException
 
 - 
deleteByQuerypublic void deleteByQuery(DeleteUpdateCommand cmd) throws IOException - Specified by:
- deleteByQueryin class- UpdateHandler
- Throws:
- IOException
 
 - 
mergeIndexespublic int mergeIndexes(MergeIndexesCommand cmd) throws IOException - Specified by:
- mergeIndexesin class- UpdateHandler
- Throws:
- IOException
 
 - 
prepareCommitpublic void prepareCommit(CommitUpdateCommand cmd) throws IOException - Throws:
- IOException
 
 - 
commitpublic void commit(CommitUpdateCommand cmd) throws IOException - Specified by:
- commitin class- UpdateHandler
- Throws:
- IOException
 
 - 
newIndexWriterpublic void newIndexWriter(boolean rollback) throws IOExceptionDescription copied from class:UpdateHandlerCalled when the Writer should be opened again - eg when replication replaces all of the index files.- Specified by:
- newIndexWriterin class- UpdateHandler
- Parameters:
- rollback- IndexWriter if true else close
- Throws:
- IOException- If there is a low-level I/O error.
 
 - 
rollbackpublic void rollback(RollbackUpdateCommand cmd) throws IOException - Specified by:
- rollbackin class- UpdateHandler
- Throws:
- IOException
- Since:
- Solr 1.4
 
 - 
getUpdateLogpublic UpdateLog getUpdateLog() - Specified by:
- getUpdateLogin class- UpdateHandler
 
 - 
closepublic void close() throws IOExceptionDescription copied from interface:SolrMetricProducerImplementations should always callSolrMetricProducer.super.close()to ensure that metrics with the same life-cycle as this component are properly unregistered. This prevents obscure memory leaks.from: https://docs.oracle.com/javase/8/docs/api/java/lang/AutoCloseable.html While this interface method is declared to throw Exception, implementers are strongly encouraged to declare concrete implementations of the close method to throw more specific exceptions, or to throw no exception at all if the close operation cannot fail. - Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- SolrMetricProducer
- Throws:
- IOException
 
 - 
closeWriterpublic void closeWriter(org.apache.lucene.index.IndexWriter writer) throws IOException- Specified by:
- closeWriterin interface- SolrCoreState.IndexWriterCloser
- Throws:
- IOException
 
 - 
splitpublic void split(SplitIndexCommand cmd) throws IOException - Specified by:
- splitin class- UpdateHandler
- Throws:
- IOException
 
 - 
getNamepublic String getName() Description copied from interface:SolrInfoBeanSimple common usage name, e.g. BasicQueryHandler, or fully qualified class name.- Specified by:
- getNamein interface- SolrInfoBean
 
 - 
getDescriptionpublic String getDescription() Description copied from interface:SolrInfoBeanSimple one or two line description- Specified by:
- getDescriptionin interface- SolrInfoBean
 
 - 
getSolrCoreStatepublic SolrCoreState getSolrCoreState() - Specified by:
- getSolrCoreStatein class- UpdateHandler
 
 - 
getCommitTrackerpublic CommitTracker getCommitTracker() 
 - 
getSoftCommitTrackerpublic CommitTracker getSoftCommitTracker() 
 
- 
 
-