Package org.apache.solr.update
Class DirectUpdateHandler2
- java.lang.Object
-
- org.apache.solr.update.UpdateHandler
-
- org.apache.solr.update.DirectUpdateHandler2
-
- All Implemented Interfaces:
SolrInfoBean
,SolrMetricProducer
,SolrCoreState.IndexWriterCloser
public class DirectUpdateHandler2 extends UpdateHandler implements SolrCoreState.IndexWriterCloser, SolrMetricProducer
DirectUpdateHandler2
implements 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.SolrInfoBean
SolrInfoBean.Category, SolrInfoBean.Group
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
commitOnClose
protected CommitTracker
commitTracker
protected boolean
commitWithinSoftCommit
protected boolean
indexWriterCloseWaitsForMerges
protected CommitTracker
softCommitTracker
protected SolrCoreState
solrCoreState
-
Fields inherited from class org.apache.solr.update.UpdateHandler
commitCallbacks, core, idField, idFieldType, metricNames, optimizeCallbacks, registry, softCommitCallbacks, ulog
-
-
Constructor Summary
Constructors Constructor Description DirectUpdateHandler2(SolrCore core)
DirectUpdateHandler2(SolrCore core, UpdateHandler updateHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
addDoc(AddUpdateCommand cmd)
void
clearIndex()
void
close()
void
closeWriter(org.apache.lucene.index.IndexWriter writer)
void
commit(CommitUpdateCommand cmd)
void
delete(DeleteUpdateCommand cmd)
void
deleteByQuery(DeleteUpdateCommand cmd)
CommitTracker
getCommitTracker()
String
getDescription()
Simple one or two line descriptionString
getName()
Simple common usage name, e.g.CommitTracker
getSoftCommitTracker()
SolrCoreState
getSolrCoreState()
UpdateLog
getUpdateLog()
void
initializeMetrics(SolrMetricManager manager, String registryName, String tag, String scope)
Initializes metrics specific to this producerint
mergeIndexes(MergeIndexesCommand cmd)
void
newIndexWriter(boolean rollback)
Called when the Writer should be opened again - eg when replication replaces all of the index files.void
prepareCommit(CommitUpdateCommand cmd)
void
rollback(RollbackUpdateCommand cmd)
protected void
rollbackWriter()
void
split(SplitIndexCommand cmd)
-
Methods inherited from class org.apache.solr.update.UpdateHandler
callPostCommitCallbacks, callPostOptimizeCallbacks, callPostSoftCommitCallbacks, getCategory, getMetricNames, getMetricRegistry, informEventListeners, registerCommitCallback, registerOptimizeCallback, registerSoftCommitCallback
-
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
getMetricsSnapshot, registerMetricName
-
-
-
-
Field Detail
-
solrCoreState
protected final SolrCoreState solrCoreState
-
commitTracker
protected final CommitTracker commitTracker
-
softCommitTracker
protected final CommitTracker softCommitTracker
-
commitWithinSoftCommit
protected boolean commitWithinSoftCommit
-
indexWriterCloseWaitsForMerges
protected boolean indexWriterCloseWaitsForMerges
-
commitOnClose
public static volatile boolean commitOnClose
-
-
Constructor Detail
-
DirectUpdateHandler2
public DirectUpdateHandler2(SolrCore core)
-
DirectUpdateHandler2
public DirectUpdateHandler2(SolrCore core, UpdateHandler updateHandler)
-
-
Method Detail
-
initializeMetrics
public void initializeMetrics(SolrMetricManager manager, String registryName, String tag, String scope)
Description copied from interface:SolrMetricProducer
Initializes metrics specific to this producer- Specified by:
initializeMetrics
in interfaceSolrMetricProducer
- Parameters:
manager
- an instance ofSolrMetricManager
registryName
- registry name where metrics are registeredtag
- a symbolic tag that represents this instance of the producer, or a group of related instances that have the same life-cycle. This tag is used when managing life-cycle of some metrics and is set whenSolrMetricProducer.initializeMetrics(SolrMetricManager, String, String, String)
is called.scope
- scope of the metrics (eg. handler name) to separate metrics of
-
rollbackWriter
protected void rollbackWriter() throws IOException
- Throws:
IOException
-
addDoc
public int addDoc(AddUpdateCommand cmd) throws IOException
- Specified by:
addDoc
in classUpdateHandler
- Throws:
IOException
-
delete
public void delete(DeleteUpdateCommand cmd) throws IOException
- Specified by:
delete
in classUpdateHandler
- Throws:
IOException
-
clearIndex
public void clearIndex() throws IOException
- Throws:
IOException
-
deleteByQuery
public void deleteByQuery(DeleteUpdateCommand cmd) throws IOException
- Specified by:
deleteByQuery
in classUpdateHandler
- Throws:
IOException
-
mergeIndexes
public int mergeIndexes(MergeIndexesCommand cmd) throws IOException
- Specified by:
mergeIndexes
in classUpdateHandler
- Throws:
IOException
-
prepareCommit
public void prepareCommit(CommitUpdateCommand cmd) throws IOException
- Throws:
IOException
-
commit
public void commit(CommitUpdateCommand cmd) throws IOException
- Specified by:
commit
in classUpdateHandler
- Throws:
IOException
-
newIndexWriter
public void newIndexWriter(boolean rollback) throws IOException
Description copied from class:UpdateHandler
Called when the Writer should be opened again - eg when replication replaces all of the index files.- Specified by:
newIndexWriter
in classUpdateHandler
- Parameters:
rollback
- IndexWriter if true else close- Throws:
IOException
- If there is a low-level I/O error.
-
rollback
public void rollback(RollbackUpdateCommand cmd) throws IOException
- Specified by:
rollback
in classUpdateHandler
- Throws:
IOException
- Since:
- Solr 1.4
-
getUpdateLog
public UpdateLog getUpdateLog()
- Specified by:
getUpdateLog
in classUpdateHandler
-
close
public void close() throws IOException
- Specified by:
close
in classUpdateHandler
- Throws:
IOException
-
closeWriter
public void closeWriter(org.apache.lucene.index.IndexWriter writer) throws IOException
- Specified by:
closeWriter
in interfaceSolrCoreState.IndexWriterCloser
- Throws:
IOException
-
split
public void split(SplitIndexCommand cmd) throws IOException
- Specified by:
split
in classUpdateHandler
- Throws:
IOException
-
getName
public String getName()
Description copied from interface:SolrInfoBean
Simple common usage name, e.g. BasicQueryHandler, or fully qualified class name.- Specified by:
getName
in interfaceSolrInfoBean
-
getDescription
public String getDescription()
Description copied from interface:SolrInfoBean
Simple one or two line description- Specified by:
getDescription
in interfaceSolrInfoBean
-
getSolrCoreState
public SolrCoreState getSolrCoreState()
- Specified by:
getSolrCoreState
in classUpdateHandler
-
getCommitTracker
public CommitTracker getCommitTracker()
-
getSoftCommitTracker
public CommitTracker getSoftCommitTracker()
-
-