public class DirectUpdateHandler2 extends UpdateHandler
DirectUpdateHandler2
implements an UpdateHandler where documents are added
directly to the main Lucene index as opposed to adding to a separate smaller index.
For this reason, not all combinations to/from pending and committed are supported.
This version supports efficient removal of duplicates on a commit. It works by maintaining
a related count for every document being added or deleted. At commit time, for every id with a count,
all but the last "count" docs with that id are deleted.
Supported add command parameters:
allowDups | overwritePending | overwriteCommitted | efficiency |
---|---|---|---|
false | false | true | fast |
true or false | true | true | fast |
true | false | false | fastest |
Supported delete commands:
command | fromPending | fromCommitted | efficiency |
---|---|---|---|
delete | true | true | fast |
deleteByQuery | true | true | very slow* |
* deleteByQuery causes a commit to happen (close current index writer, open new index reader) before it can be processed. If deleteByQuery functionality is needed, it's best if they can be batched and executed together so they may share the same index reader.
UpdateHandler.DeleteHitCollector
SolrInfoMBean.Category
Modifier and Type | Field and Description |
---|---|
(package private) java.util.concurrent.atomic.AtomicLong |
addCommands |
(package private) java.util.concurrent.atomic.AtomicLong |
addCommandsCumulative |
(package private) java.util.concurrent.atomic.AtomicLong |
commitCommands |
protected CommitTracker |
commitTracker |
(package private) java.util.concurrent.atomic.AtomicLong |
deleteByIdCommands |
(package private) java.util.concurrent.atomic.AtomicLong |
deleteByIdCommandsCumulative |
(package private) java.util.concurrent.atomic.AtomicLong |
deleteByQueryCommands |
(package private) java.util.concurrent.atomic.AtomicLong |
deleteByQueryCommandsCumulative |
(package private) java.util.concurrent.atomic.AtomicLong |
expungeDeleteCommands |
protected java.util.concurrent.locks.Lock |
iwAccess |
protected java.util.concurrent.locks.Lock |
iwCommit |
(package private) java.util.concurrent.atomic.AtomicLong |
mergeIndexesCommands |
(package private) java.util.concurrent.atomic.AtomicLong |
numDocsPending |
(package private) java.util.concurrent.atomic.AtomicLong |
numErrors |
(package private) java.util.concurrent.atomic.AtomicLong |
numErrorsCumulative |
(package private) java.util.concurrent.atomic.AtomicLong |
optimizeCommands |
(package private) java.util.concurrent.atomic.AtomicLong |
rollbackCommands |
protected org.apache.lucene.index.IndexWriter |
writer |
commitCallbacks, core, idField, idFieldType, idTerm, log, optimizeCallbacks, schema
Constructor and Description |
---|
DirectUpdateHandler2(SolrCore core) |
Modifier and Type | Method and Description |
---|---|
int |
addDoc(AddUpdateCommand cmd) |
void |
close() |
protected void |
closeWriter() |
void |
commit(CommitUpdateCommand cmd) |
void |
delete(DeleteUpdateCommand cmd) |
private void |
deleteAll() |
void |
deleteByQuery(DeleteUpdateCommand cmd) |
void |
forceOpenWriter() |
SolrInfoMBean.Category |
getCategory()
Purpose of this Class
|
java.lang.String |
getDescription()
Simple one or two line description
|
java.net.URL[] |
getDocs()
Documentation URL list.
|
java.lang.String |
getName()
Simple common usage name, e.g.
|
java.lang.String |
getSource()
CVS Source, SVN Source, etc
|
java.lang.String |
getSourceId()
CVS Id, SVN Id, etc
|
NamedList |
getStatistics()
Any statistics this instance would like to be publicly available via
the Solr Administration interface.
|
java.lang.String |
getVersion()
Simple common usage version, e.g.
|
int |
mergeIndexes(MergeIndexesCommand cmd) |
protected void |
openWriter() |
void |
rollback(RollbackUpdateCommand cmd) |
protected void |
rollbackWriter() |
java.lang.String |
toString() |
callPostCommitCallbacks, callPostOptimizeCallbacks, createMainIndexWriter, getIndexedId, getIndexedIdOptional, idTerm, registerCommitCallback, registerOptimizeCallback
java.util.concurrent.atomic.AtomicLong addCommands
java.util.concurrent.atomic.AtomicLong addCommandsCumulative
java.util.concurrent.atomic.AtomicLong deleteByIdCommands
java.util.concurrent.atomic.AtomicLong deleteByIdCommandsCumulative
java.util.concurrent.atomic.AtomicLong deleteByQueryCommands
java.util.concurrent.atomic.AtomicLong deleteByQueryCommandsCumulative
java.util.concurrent.atomic.AtomicLong expungeDeleteCommands
java.util.concurrent.atomic.AtomicLong mergeIndexesCommands
java.util.concurrent.atomic.AtomicLong commitCommands
java.util.concurrent.atomic.AtomicLong optimizeCommands
java.util.concurrent.atomic.AtomicLong rollbackCommands
java.util.concurrent.atomic.AtomicLong numDocsPending
java.util.concurrent.atomic.AtomicLong numErrors
java.util.concurrent.atomic.AtomicLong numErrorsCumulative
protected final CommitTracker commitTracker
protected final java.util.concurrent.locks.Lock iwAccess
protected final java.util.concurrent.locks.Lock iwCommit
protected org.apache.lucene.index.IndexWriter writer
public DirectUpdateHandler2(SolrCore core) throws java.io.IOException
java.io.IOException
private void deleteAll() throws java.io.IOException
java.io.IOException
protected void openWriter() throws java.io.IOException
java.io.IOException
protected void closeWriter() throws java.io.IOException
java.io.IOException
protected void rollbackWriter() throws java.io.IOException
java.io.IOException
public int addDoc(AddUpdateCommand cmd) throws java.io.IOException
addDoc
in class UpdateHandler
java.io.IOException
public void delete(DeleteUpdateCommand cmd) throws java.io.IOException
delete
in class UpdateHandler
java.io.IOException
public void deleteByQuery(DeleteUpdateCommand cmd) throws java.io.IOException
deleteByQuery
in class UpdateHandler
java.io.IOException
public int mergeIndexes(MergeIndexesCommand cmd) throws java.io.IOException
mergeIndexes
in class UpdateHandler
java.io.IOException
public void forceOpenWriter() throws java.io.IOException
java.io.IOException
public void commit(CommitUpdateCommand cmd) throws java.io.IOException
commit
in class UpdateHandler
java.io.IOException
public void rollback(RollbackUpdateCommand cmd) throws java.io.IOException
rollback
in class UpdateHandler
java.io.IOException
public void close() throws java.io.IOException
close
in class UpdateHandler
java.io.IOException
public java.lang.String getName()
SolrInfoMBean
public java.lang.String getVersion()
SolrInfoMBean
public java.lang.String getDescription()
SolrInfoMBean
public SolrInfoMBean.Category getCategory()
SolrInfoMBean
public java.lang.String getSourceId()
SolrInfoMBean
public java.lang.String getSource()
SolrInfoMBean
public java.net.URL[] getDocs()
SolrInfoMBean
Suggested documentation URLs: Homepage for sponsoring project, FAQ on class usage, Design doc for class, Wiki, bug reporting URL, etc...
public NamedList getStatistics()
SolrInfoMBean
Any Object type may be stored in the list, but only the
toString()
representation will be used.
public java.lang.String toString()
toString
in class java.lang.Object