Package org.apache.solr.update
Class AddUpdateCommand
- java.lang.Object
-
- org.apache.solr.update.UpdateCommand
-
- org.apache.solr.update.AddUpdateCommand
-
- All Implemented Interfaces:
Cloneable
public class AddUpdateCommand extends UpdateCommand
AnUpdateCommand
for adding or updating one document. Technically more than one Lucene documents may be involved in the event of nested documents.
-
-
Field Summary
Fields Modifier and Type Field Description int
commitWithin
boolean
isLastDocInBatch
Boolean
isNested
Is this a nested update, null means not yet calculated.boolean
overwrite
long
prevVersion
This is the version of a document, previously indexed, on which the current update depends on.SolrInputDocument
solrDoc
Higher level SolrInputDocument, normally used to construct the Lucene Document(s) to index.org.apache.lucene.index.Term
updateTerm
The term to use to delete an existing document (for dedupe).-
Fields inherited from class org.apache.solr.update.UpdateCommand
BUFFERING, CLEAR_CACHES, flags, IGNORE_AUTOCOMMIT, IGNORE_INDEXWRITER, PEER_SYNC, REPLAY, req, route, version
-
-
Constructor Summary
Constructors Constructor Description AddUpdateCommand(SolrQueryRequest req)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Reset state to reuse this object with a different document in the same requestString
getHashableId()
org.apache.lucene.util.BytesRef
getIndexedId()
Returns the indexed ID for this document.Iterable<org.apache.lucene.document.Document>
getLuceneDocsIfNested()
Computes the final flattened Solr docs that are ready to be converted to Lucene docs.org.apache.lucene.document.Document
getLuceneDocument()
Creates and returns a lucene Document to index.String
getPrintableId()
String
getRootIdUsingRouteParam()
SolrInputDocument
getSolrInputDocument()
boolean
isInPlaceUpdate()
Is this add update an in-place update? An in-place update is one where only docValues are updated, and a new document is not indexed.String
name()
void
setIndexedId(org.apache.lucene.util.BytesRef indexedId)
String
toString()
-
Methods inherited from class org.apache.solr.update.UpdateCommand
clone, getFlags, getReq, getRoute, getVersion, setFlags, setReq, setRoute, setVersion
-
-
-
-
Field Detail
-
solrDoc
public SolrInputDocument solrDoc
Higher level SolrInputDocument, normally used to construct the Lucene Document(s) to index.
-
prevVersion
public long prevVersion
This is the version of a document, previously indexed, on which the current update depends on. This version could be that of a previous in-place update or a full update. A negative value here, e.g. -1, indicates that this add update does not depend on a previous update.
-
overwrite
public boolean overwrite
-
updateTerm
public org.apache.lucene.index.Term updateTerm
The term to use to delete an existing document (for dedupe). (optional)
-
commitWithin
public int commitWithin
-
isLastDocInBatch
public boolean isLastDocInBatch
-
isNested
public Boolean isNested
Is this a nested update, null means not yet calculated.
-
-
Constructor Detail
-
AddUpdateCommand
public AddUpdateCommand(SolrQueryRequest req)
-
-
Method Detail
-
name
public String name()
- Specified by:
name
in classUpdateCommand
-
clear
public void clear()
Reset state to reuse this object with a different document in the same request
-
getSolrInputDocument
public SolrInputDocument getSolrInputDocument()
-
getLuceneDocument
public org.apache.lucene.document.Document getLuceneDocument()
Creates and returns a lucene Document to index. Nested documents, if found, will cause an exception to be thrown. CallgetLuceneDocsIfNested()
for that. Any changes made to the returned Document will not be reflected in the SolrInputDocument, or future calls to this method. Note that the behavior of this is sensitive toisInPlaceUpdate()
.
-
getIndexedId
public org.apache.lucene.util.BytesRef getIndexedId()
Returns the indexed ID for this document. The returned BytesRef is retained across multiple calls, and should not be modified.
-
setIndexedId
public void setIndexedId(org.apache.lucene.util.BytesRef indexedId)
-
getPrintableId
public String getPrintableId()
-
getRootIdUsingRouteParam
public String getRootIdUsingRouteParam()
- Returns:
- value of _route_ param(
ShardParams._ROUTE_
), otherwise doc id.
-
getHashableId
public String getHashableId()
- Returns:
- String id to hash
-
getLuceneDocsIfNested
public Iterable<org.apache.lucene.document.Document> getLuceneDocsIfNested()
Computes the final flattened Solr docs that are ready to be converted to Lucene docs. If no flattening is performed then we return null, and the caller ought to usegetLuceneDocument()
instead. This should only be called once. Any changes made to the returned Document(s) will not be reflected in the SolrInputDocument, or future calls to this method.
-
toString
public String toString()
- Overrides:
toString
in classUpdateCommand
-
isInPlaceUpdate
public boolean isInPlaceUpdate()
Is this add update an in-place update? An in-place update is one where only docValues are updated, and a new document is not indexed.
-
-