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.
SolrInfoMBean.Category| Modifier and Type | Field and Description |
|---|---|
protected org.apache.solr.update.CommitTracker |
commitTracker |
protected Lock |
iwAccess |
protected Lock |
iwCommit |
protected 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) |
void |
deleteByQuery(DeleteUpdateCommand cmd) |
void |
forceOpenWriter() |
SolrInfoMBean.Category |
getCategory()
Purpose of this Class
|
String |
getDescription()
Simple one or two line description
|
URL[] |
getDocs()
Documentation URL list.
|
String |
getName()
Simple common usage name, e.g.
|
String |
getSource()
CVS Source, SVN Source, etc
|
String |
getSourceId()
CVS Id, SVN Id, etc
|
NamedList |
getStatistics()
Any statistics this instance would like to be publicly available via
the Solr Administration interface.
|
String |
getVersion()
Simple common usage version, e.g. 2.0
|
int |
mergeIndexes(MergeIndexesCommand cmd) |
protected void |
openWriter() |
void |
rollback(RollbackUpdateCommand cmd) |
protected void |
rollbackWriter() |
String |
toString() |
callPostCommitCallbacks, callPostOptimizeCallbacks, createMainIndexWriter, getIndexedId, getIndexedIdOptional, idTerm, registerCommitCallback, registerOptimizeCallbackprotected final org.apache.solr.update.CommitTracker commitTracker
protected final Lock iwAccess
protected final Lock iwCommit
protected IndexWriter writer
public DirectUpdateHandler2(SolrCore core) throws IOException
IOExceptionprotected void openWriter()
throws IOException
IOExceptionprotected void closeWriter()
throws IOException
IOExceptionprotected void rollbackWriter()
throws IOException
IOExceptionpublic int addDoc(AddUpdateCommand cmd) throws IOException
addDoc in class UpdateHandlerIOExceptionpublic void delete(DeleteUpdateCommand cmd) throws IOException
delete in class UpdateHandlerIOExceptionpublic void deleteByQuery(DeleteUpdateCommand cmd) throws IOException
deleteByQuery in class UpdateHandlerIOExceptionpublic int mergeIndexes(MergeIndexesCommand cmd) throws IOException
mergeIndexes in class UpdateHandlerIOExceptionpublic void forceOpenWriter()
throws IOException
IOExceptionpublic void commit(CommitUpdateCommand cmd) throws IOException
commit in class UpdateHandlerIOExceptionpublic void rollback(RollbackUpdateCommand cmd) throws IOException
rollback in class UpdateHandlerIOExceptionpublic void close()
throws IOException
close in class UpdateHandlerIOExceptionpublic String getName()
SolrInfoMBeanpublic String getVersion()
SolrInfoMBeanpublic String getDescription()
SolrInfoMBeanpublic SolrInfoMBean.Category getCategory()
SolrInfoMBeanpublic String getSourceId()
SolrInfoMBeanpublic String getSource()
SolrInfoMBeanpublic URL[] getDocs()
SolrInfoMBeanSuggested 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.