public class AlfrescoUpdateHandler2
extends org.apache.solr.update.DirectUpdateHandler2
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.
| Modifier and Type | Field and Description |
|---|---|
protected Lock |
iwAccess |
protected Lock |
iwCommit |
protected static org.slf4j.Logger |
log |
protected org.alfresco.solr.AlfrescoUpdateHandler2.CommitTracker |
tracker |
protected org.apache.lucene.index.IndexWriter |
writer |
| Constructor and Description |
|---|
AlfrescoUpdateHandler2(org.apache.solr.core.SolrCore core) |
| Modifier and Type | Method and Description |
|---|---|
int |
addDoc(org.apache.solr.update.AddUpdateCommand cmd) |
void |
close() |
protected void |
closeWriter() |
void |
commit(org.apache.solr.update.CommitUpdateCommand cmd) |
void |
delete(org.apache.solr.update.DeleteUpdateCommand cmd) |
void |
deleteByQuery(org.apache.solr.update.DeleteUpdateCommand cmd) |
void |
forceOpenWriter() |
org.apache.solr.core.SolrInfoMBean.Category |
getCategory() |
String |
getDescription() |
URL[] |
getDocs() |
String |
getName() |
String |
getSource() |
String |
getSourceId() |
org.apache.solr.common.util.NamedList |
getStatistics() |
String |
getVersion() |
int |
mergeIndexes(org.apache.solr.update.MergeIndexesCommand cmd) |
protected void |
openWriter() |
void |
rollback(org.apache.solr.update.RollbackUpdateCommand cmd) |
protected void |
rollbackWriter() |
String |
toString() |
protected static final org.slf4j.Logger log
protected final org.alfresco.solr.AlfrescoUpdateHandler2.CommitTracker tracker
protected final Lock iwAccess
protected final Lock iwCommit
protected org.apache.lucene.index.IndexWriter writer
public AlfrescoUpdateHandler2(org.apache.solr.core.SolrCore core)
throws IOException
IOExceptionprotected void openWriter()
throws IOException
openWriter in class org.apache.solr.update.DirectUpdateHandler2IOExceptionprotected void closeWriter()
throws IOException
closeWriter in class org.apache.solr.update.DirectUpdateHandler2IOExceptionprotected void rollbackWriter()
throws IOException
rollbackWriter in class org.apache.solr.update.DirectUpdateHandler2IOExceptionpublic int addDoc(org.apache.solr.update.AddUpdateCommand cmd)
throws IOException
addDoc in class org.apache.solr.update.DirectUpdateHandler2IOExceptionpublic void delete(org.apache.solr.update.DeleteUpdateCommand cmd)
throws IOException
delete in class org.apache.solr.update.DirectUpdateHandler2IOExceptionpublic void deleteByQuery(org.apache.solr.update.DeleteUpdateCommand cmd)
throws IOException
deleteByQuery in class org.apache.solr.update.DirectUpdateHandler2IOExceptionpublic int mergeIndexes(org.apache.solr.update.MergeIndexesCommand cmd)
throws IOException
mergeIndexes in class org.apache.solr.update.DirectUpdateHandler2IOExceptionpublic void forceOpenWriter()
throws IOException
forceOpenWriter in class org.apache.solr.update.DirectUpdateHandler2IOExceptionpublic void commit(org.apache.solr.update.CommitUpdateCommand cmd)
throws IOException
commit in class org.apache.solr.update.DirectUpdateHandler2IOExceptionpublic void rollback(org.apache.solr.update.RollbackUpdateCommand cmd)
throws IOException
rollback in class org.apache.solr.update.DirectUpdateHandler2IOExceptionpublic void close()
throws IOException
close in class org.apache.solr.update.DirectUpdateHandler2IOExceptionpublic String getName()
getName in interface org.apache.solr.core.SolrInfoMBeangetName in class org.apache.solr.update.DirectUpdateHandler2public String getVersion()
getVersion in interface org.apache.solr.core.SolrInfoMBeangetVersion in class org.apache.solr.update.DirectUpdateHandler2public String getDescription()
getDescription in interface org.apache.solr.core.SolrInfoMBeangetDescription in class org.apache.solr.update.DirectUpdateHandler2public org.apache.solr.core.SolrInfoMBean.Category getCategory()
getCategory in interface org.apache.solr.core.SolrInfoMBeangetCategory in class org.apache.solr.update.DirectUpdateHandler2public String getSourceId()
getSourceId in interface org.apache.solr.core.SolrInfoMBeangetSourceId in class org.apache.solr.update.DirectUpdateHandler2public String getSource()
getSource in interface org.apache.solr.core.SolrInfoMBeangetSource in class org.apache.solr.update.DirectUpdateHandler2public URL[] getDocs()
getDocs in interface org.apache.solr.core.SolrInfoMBeangetDocs in class org.apache.solr.update.DirectUpdateHandler2public org.apache.solr.common.util.NamedList getStatistics()
getStatistics in interface org.apache.solr.core.SolrInfoMBeangetStatistics in class org.apache.solr.update.DirectUpdateHandler2public String toString()
toString in class org.apache.solr.update.DirectUpdateHandler2Copyright © 2005–2014 Alfresco Software. All rights reserved.