Class AddUpdateCommand

  • All Implemented Interfaces:
    Cloneable

    public class AddUpdateCommand
    extends UpdateCommand
    An UpdateCommand for adding or updating one document. Technically more than one Lucene documents may be involved in the event of nested documents.
    • 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.
    • Method Detail

      • clear

        public void clear()
        Reset state to reuse this object with a different document in the same request
      • 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. Call getLuceneDocsIfNested() 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 to isInPlaceUpdate().
      • 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 use getLuceneDocument() 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.
      • 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.