|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.solr.update.UpdateHandler
org.apache.solr.update.DirectUpdateHandler2
public class 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.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.apache.solr.core.SolrInfoMBean |
---|
SolrInfoMBean.Category |
Field Summary | |
---|---|
protected java.util.concurrent.locks.Lock |
iwAccess
|
protected java.util.concurrent.locks.Lock |
iwCommit
|
protected static java.lang.Integer |
ONE
|
protected java.util.Map<java.lang.String,java.lang.Integer> |
pset
|
protected SolrIndexSearcher |
searcher
|
protected org.apache.solr.update.DirectUpdateHandler2.CommitTracker |
tracker
|
protected org.apache.lucene.index.IndexWriter |
writer
|
protected static java.lang.Integer |
ZERO
|
Fields inherited from class org.apache.solr.update.UpdateHandler |
---|
commitCallbacks, core, idField, idFieldType, log, optimizeCallbacks, schema |
Constructor Summary | |
---|---|
DirectUpdateHandler2(SolrCore core)
|
Method Summary | |
---|---|
protected int |
addConditionally(AddUpdateCommand cmd)
|
int |
addDoc(AddUpdateCommand cmd)
|
protected int |
allowDups(AddUpdateCommand cmd)
|
void |
close()
|
protected void |
closeSearcher()
|
protected void |
closeWriter()
|
void |
commit(CommitUpdateCommand cmd)
|
void |
delete(DeleteUpdateCommand cmd)
|
void |
deleteByQuery(DeleteUpdateCommand cmd)
|
protected void |
doDeletions()
|
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. |
protected void |
openSearcher()
|
protected void |
openWriter()
|
protected int |
overwriteBoth(AddUpdateCommand cmd)
|
java.lang.String |
toString()
|
Methods inherited from class org.apache.solr.update.UpdateHandler |
---|
callPostCommitCallbacks, callPostOptimizeCallbacks, createMainIndexWriter, getIndexedId, getIndexedIdOptional, idTerm |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final org.apache.solr.update.DirectUpdateHandler2.CommitTracker tracker
protected final java.util.Map<java.lang.String,java.lang.Integer> pset
protected static final java.lang.Integer ZERO
protected static final java.lang.Integer ONE
protected final java.util.concurrent.locks.Lock iwAccess
protected final java.util.concurrent.locks.Lock iwCommit
protected org.apache.lucene.index.IndexWriter writer
protected SolrIndexSearcher searcher
Constructor Detail |
---|
public DirectUpdateHandler2(SolrCore core) throws java.io.IOException
java.io.IOException
Method Detail |
---|
protected void openWriter() throws java.io.IOException
java.io.IOException
protected void closeWriter() throws java.io.IOException
java.io.IOException
protected void openSearcher() throws java.io.IOException
java.io.IOException
protected void closeSearcher() 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
protected int addConditionally(AddUpdateCommand cmd) throws java.io.IOException
java.io.IOException
protected int overwriteBoth(AddUpdateCommand cmd) throws java.io.IOException
java.io.IOException
protected int allowDups(AddUpdateCommand cmd) throws java.io.IOException
java.io.IOException
protected void doDeletions() 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 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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |