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